June 22nd, 2000, 09:21 PM
I am trying to parse out a string. Lets say the string is x length with spaces every so often. They spaces are random. I want to parse out every 50 characters, but if that 50th character isn't a space to lengthen what it is going to parse out until it reaches a space. After that do the loop until there is no more string left to parse.
--Any help is greatly appreciated since I have been driving myself insane over this! THANKS!
June 22nd, 2000, 10:25 PM
$c = 0;
$pos = 0;
while ( $c < strlen($text) )
$c += 50;
for ($more = $c; $more < strlen($text) AND $text[$more] != ' '; $more++)
echo "$more <br>n";
$ntext = $more . '|' . substr($text, $pos, ($more - $pos));
$pos = $more;
$c = $more;
for ($count = 0; $count < count($ntext); $count++)
echo "$count $ntext[$count]<br>n";
$text is your initial string, $ntext if your exploded version.
June 22nd, 2000, 10:28 PM
oops dump the
and replace with
hehe, debug code.
June 22nd, 2000, 10:43 PM
THANKS!!!! That helped emensly. I was just goofing up in a couple places but now I see what I did wrong! 1,000 thank yous!!! :-)