Working with text.

  • Thread starter Thread starter Jensen bredal
  • Start date Start date
J

Jensen bredal

Hello,
I have stored some text in my database. I want to retrive the first two
lines from text and display it in a an asp.net page..
How to get the first two lines from my text?

Any good way of doint this?


Many thanks
JB
 
I have a database field as ntext.


I want to display this page only the first two lines. i retriev
the field in my c# code as text.

How do i process it to display the first two "newline terminated" character
sequences
in my text?
 
I have a database field as ntext.


I want to display this page only the first two lines. i retriev
the field in my c# code as text.

How do i process it to display the first two "newline terminated" character
sequences
in my text?


If you're referring to showing the text up to the 2nd new line escape
character, "\n", then perhaps something similar to this:

//assuming you're placing each row's returned text into a string; str

//string str;

int i = str.IndexOf(Environment.NewLine); // find 1st newline
int i = str.IndexOf(Environment.NewLine, i+1); // fine 2nd newline

str = str.Substring(0, i); // return text from start to 2nd newline




There may be a better way of finding the 2nd instance of the
Environment.NewLine or "\n" but it's 3:26 am here and I'm a bit
sleepy. Let me know if this is similar to what you're looking for. I'm
sure this is by far not the best solution. Også, I may just not be
understanding clearly your question.

adjø fra Oregon!


Michael Hughes - Silverton, Oregon
http://wou.ath.cx/Trivia
http://wou.ath.cx/AmateurRadio
 
Back
Top