|  | Posted by dino d. on 07/12/07 21:14 
I need to parse a string by linefeeds and paragraphs.  I need topreserve 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:
 
 $text=
 "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?
 
 Thanks,
 Dino
  Navigation: [Reply to this message] |