Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to split a string into two lines, intelligently

by Andrew Coolman (Hermit)
on Oct 09, 2008 at 22:41 UTC ( #716331=note: print w/ replies, xml ) Need Help??


in reply to How to split a string into two lines, intelligently

This one might work if the characters are separated by spaces:

@arr = split (/\s/,$string); $part1 = (); $part2 = (); $len = 0; while (($len += 1 + length($part = shift @arr)) < 50) { $part1 .= "$part "; } $part2 = join(' ', @arr);

Regards,
s++ą  ł˝ ął. Ş ş şą Żľ ľą˛ş ą ŻĽąş.}++y~-~?-{~/s**$_*ee


Comment on Re: How to split a string into two lines, intelligently
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://716331]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2014-08-20 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (105 votes), past polls