Arjan
02-22-2006, 02:59 PM
I have a text in $mytext
Now I want to cut that text after the 5th line.
Doing so by estimating that every line is, say 100 chars, doesn't allways work.
Like in this case where every line has a line feed:
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
How can I detect (and count) the line feeds in this text and determine which one is the 5th, so I know where to cut my text?
Now I want to cut that text after the 5th line.
Doing so by estimating that every line is, say 100 chars, doesn't allways work.
Like in this case where every line has a line feed:
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
How can I detect (and count) the line feeds in this text and determine which one is the 5th, so I know where to cut my text?