help parsing linefeeds

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I need to parse a string by linefeeds and paragraphs.  I need to
preserve all periods and linefeeds too, so I can't simply use strtok
or explode (both of which don't tell you where or which (period of lf)
delimiter was found).  So, I've written a function that tells me where
the periods and linefeeds are. The problem is, I am having trouble
figuring out what the character values are for the linefeed.

For example, suppose I have this string:

"This is a sentence.  I need to find linefeeds and periods.

Sometimes a sentence will end in a period.  Sometimes not

I need to capture them all";

So, basically, I need to grab all of the sentences, AND preserve the
knowledge of where all the periods and line feeds are.  But, it looks
like I'm encountering multiple characters for a hard return. Which is
strange, because simply comparing a character to "\n" is finding the
locations of the hard returns fine. So two questions-

1) Is there a way to display the ASCII value of a char in PHP?
2) Is there an easy way to find and save the location of all of the
hard returns?


Re: help parsing linefeeds

Quoted text here. Click to load it

As for #1, take a look at ord():

Site Timeline