Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by Tomte (Priest)
on May 11, 2007 at 08:03 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (None)
    As of 2024-04-25 01:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found