Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How do I truncate a string while preserving words?

by Tomte (Priest)
on May 11, 2007 at 08:03 UTC ( #614841=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $string =~ s/^(.{0,$maxlength})\b.*$/$1.../s;
    
  2. or download this
         {n}?   Match exactly n times
         {n,}?  Match at least n times
         {n,m}? Match at least n but not more than m times
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2023-06-07 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (29 votes). Check out past polls.

    Notices?