Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by JavaFan (Canon)
on Oct 09, 2008 at 22:15 UTC ( #716327=note: print w/ replies, xml ) Need Help??


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

Assuming the first word doesn't consist of more than 50 characters (in which case, no solution is possible), a simple

s/\s/\n/;
will do. The first line will not be more than 50 characters, and the remainder will be in te second line.

It's not the solution that makes the longest first string possible with the given constraints, but then, you weren't asking for it.


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://716327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-12-28 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls