nice!
(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= "a b c d e ff g"
(char)112233444
1234567890123456789012345678901234567890123456
regexp should output:
"a b c
d e
ff g"
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