Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: In search of a better way to trim string

by runrig (Abbot)
on Jul 20, 2004 at 00:26 UTC ( #375744=note: print w/ replies, xml ) Need Help??


in reply to In search of a better way to trim string

This assumes there are no newlines in the original string (at least not in an inconvenient place):

use Text::Wrap qw(wrap $columns); $columns = 30; my $trimmed = wrap('', '', $str); $trimmed =~ s/\n.*/.../s;


Comment on Re: In search of a better way to trim string
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2015-07-06 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls