(things are often under my nose, still I can't see them...I was using explode and loops...)
thx moondog
Mike Ford wrote:
On 16 April 2004 11:47, moondog wrote:
Hi, I am a RegExp newbie, and need help with this: i have a long string (500 / 600 chars), and need to split it in lines.
Each line has a maximum length (20), and words in the line
shouldn't be
cut, instead the line should end at the end of the word whose last
char position is <= 20.
the effect is like a left align in a word processor, where lines wrap at 20, and the words are not cut.
example:
string= "aaaaa bbbbb ccccc ddddd eeeee ffffffffff ggggg" (char) 1111111111222222222233333333334444444 1234567890123456789012345678901234567890123456
regexp should output:
"aaaaa bbbbb ccccc ddddd eeeee ffffffffff ggggg"
Is it a sensible thing to do this job with regExp or is it better to use the usual string functions?
The latter -- "the usual string function" in this case being http://www.php.net/wordwrap.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php