Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Counting lines of text.

Reply
Thread Tools

Counting lines of text.

 
 
Brent
Guest
Posts: n/a
 
      02-16-2005
Say that I have a text box that holds 5 lines of text. If the user
enters ten text lines, I want the first four lines of text displayed,
followed by a "More" hyperlink. The link will pop up another page to
display the rest of the text.

The problem is that I don't know how to count lines. I can count
characters, but this solution fails spectacularly when it encounters the
characters "<br/>" (which should be counted as a full line, of course).

Anyone have an idea how to solve the problem? Any resources I can look up?

Thanks for any help.

--Brent
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TmlrYW5kZXIgJiBNYXJncmlldCBCcnVnZ2VtYW4=?=
Guest
Posts: n/a
 
      02-17-2005
Maybe it helps if you establish what a line of text is, in your case. Is a
line something which is always ended by <br> or <p>, or does a newline count
as well (which could be checked using the Environment.NewLine property).

Kind regards,
Nikander & Margriet Bruggeman

"Brent" <""b b i g l e r "@ y a h o o ." wrote:

> Say that I have a text box that holds 5 lines of text. If the user
> enters ten text lines, I want the first four lines of text displayed,
> followed by a "More" hyperlink. The link will pop up another page to
> display the rest of the text.
>
> The problem is that I don't know how to count lines. I can count
> characters, but this solution fails spectacularly when it encounters the
> characters "<br/>" (which should be counted as a full line, of course).
>
> Anyone have an idea how to solve the problem? Any resources I can look up?
>
> Thanks for any help.
>
> --Brent
>

 
Reply With Quote
 
 
 
 
Brent
Guest
Posts: n/a
 
      02-17-2005
Good point. Hmmm ... I think for my purposes a line of text would be n
characters, or any of "<br>", "<p>", or like HTML. Mainly, I just want
to keep text fully inside a <div> with a fixed height and width. An
example of the problem is here:

http://www.thsalumni.com/Alumni.aspx?ID=2699

The information in the "Latest News" <div> extends beyond the box.

Thanks for any help.

--Brent

Nikander & Margriet Bruggeman wrote:
> Maybe it helps if you establish what a line of text is, in your case. Is a
> line something which is always ended by <br> or <p>, or does a newline count
> as well (which could be checked using the Environment.NewLine property).
>
> Kind regards,
> Nikander & Margriet Bruggeman
>
> "Brent" <""b b i g l e r "@ y a h o o ." wrote:
>
>
>>Say that I have a text box that holds 5 lines of text. If the user
>>enters ten text lines, I want the first four lines of text displayed,
>>followed by a "More" hyperlink. The link will pop up another page to
>>display the rest of the text.
>>
>>The problem is that I don't know how to count lines. I can count
>>characters, but this solution fails spectacularly when it encounters the
>>characters "<br/>" (which should be counted as a full line, of course).
>>
>>Anyone have an idea how to solve the problem? Any resources I can look up?
>>
>>Thanks for any help.
>>
>>--Brent
>>

 
Reply With Quote
 
=?Utf-8?B?TmlrYW5kZXIgJiBNYXJncmlldCBCcnVnZ2VtYW4=?=
Guest
Posts: n/a
 
      02-18-2005
Looks like this websites uses a very practical solution. It just seems to
count the number of characters and the text stops at that point. Maybe this
is workable for you too.

Kind regards,
Nikander & Margriet Bruggeman


"Brent" <""b b i g l e r "@ y a h o o ." wrote:

> Good point. Hmmm ... I think for my purposes a line of text would be n
> characters, or any of "<br>", "<p>", or like HTML. Mainly, I just want
> to keep text fully inside a <div> with a fixed height and width. An
> example of the problem is here:
>
> http://www.thsalumni.com/Alumni.aspx?ID=2699
>
> The information in the "Latest News" <div> extends beyond the box.
>
> Thanks for any help.
>
> --Brent
>
> Nikander & Margriet Bruggeman wrote:
> > Maybe it helps if you establish what a line of text is, in your case. Is a
> > line something which is always ended by <br> or <p>, or does a newline count
> > as well (which could be checked using the Environment.NewLine property).
> >
> > Kind regards,
> > Nikander & Margriet Bruggeman
> >
> > "Brent" <""b b i g l e r "@ y a h o o ." wrote:
> >
> >
> >>Say that I have a text box that holds 5 lines of text. If the user
> >>enters ten text lines, I want the first four lines of text displayed,
> >>followed by a "More" hyperlink. The link will pop up another page to
> >>display the rest of the text.
> >>
> >>The problem is that I don't know how to count lines. I can count
> >>characters, but this solution fails spectacularly when it encounters the
> >>characters "<br/>" (which should be counted as a full line, of course).
> >>
> >>Anyone have an idea how to solve the problem? Any resources I can look up?
> >>
> >>Thanks for any help.
> >>
> >>--Brent
> >>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting up instead of counting down edwardfredriks Javascript 6 09-07-2005 03:30 PM
Counting code lines i asp.net project Anders K. Jacobsen [DK] ASP .Net 5 07-06-2005 09:20 AM
Help with counting lines? Davidd Sargent Perl 3 08-13-2004 02:30 PM
counting matched lines in extremely large files. mikester Perl 7 12-25-2003 02:21 PM
Counting lines/characters in an uploaded .DOC/.RTF file using ASP.NET j ASP .Net 1 07-22-2003 06:23 PM



Advertisments