kweise has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, I need to split a user entered string into two lines, the first containing 50 or less characters, the second the remainder. I want to split the string on a space, so that the two lines don't split in the middle of a word.
As a shorter example "The quick brown fox jumped over the lazy dog" into:
The quick brown fox jumped
over the lazy dog
Not breaking the string in the middle of a word. But the string will be different each time, depending on what the user entered. Thanks for any help!!
As a shorter example "The quick brown fox jumped over the lazy dog" into:
The quick brown fox jumped
over the lazy dog
Not breaking the string in the middle of a word. But the string will be different each time, depending on what the user entered. Thanks for any help!!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to split a string into two lines, intelligently
by almut (Canon) on Oct 09, 2008 at 22:01 UTC | |
Re: How to split a string into two lines, intelligently
by ig (Vicar) on Oct 09, 2008 at 22:44 UTC | |
by kweise (Novice) on Oct 10, 2008 at 15:54 UTC | |
Re: How to split a string into two lines, intelligently
by RMGir (Prior) on Oct 09, 2008 at 22:46 UTC | |
by kweise (Novice) on Oct 10, 2008 at 15:21 UTC | |
by RMGir (Prior) on Oct 11, 2008 at 09:22 UTC | |
Re: How to split a string into two lines, intelligently
by GrandFather (Saint) on Oct 09, 2008 at 23:00 UTC | |
Re: How to split a string into two lines, intelligently
by Andrew Coolman (Hermit) on Oct 09, 2008 at 22:41 UTC | |
Re: How to split a string into two lines, intelligently
by JavaFan (Canon) on Oct 09, 2008 at 22:15 UTC |
Back to
Seekers of Perl Wisdom