in reply to Smart Substrings
To split between words and add .. I'd use:$string =~ s/^(.{15}).+$/$1/;
This assumes you want a string 15 chars long + the "...", if there's not a space in the 15 chars it chops it there anyways.$string =~ s/^(.{1,15})\s*.*$/$1.../;
- p u n k k i d
"Reality is merely an illusion,
albeit a very persistent one."
-Albert Einstein
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Smart Substrings
by MeowChow (Vicar) on Apr 03, 2001 at 05:09 UTC | |
by Pin (Novice) on Apr 03, 2001 at 20:48 UTC |