Help for this page

Select Code to Download


  1. or download this
    # note the lower-casing inline
    ($fus = lc $fus) =~ s/\W+/_/g; #all spans of 1 or more non-words becom
    +e 1 '_'
    $fus =~ s/^_|_$//g;            #at most one on each end, because of th
    +e above
    
  2. or download this
    for ($string) {
       s/\s+/_/g;    #convert 1+ spaces to a single '_'
       s/'|^_|_$//g; #trim lead/trail _ and remove single quotes
    }
    
  3. or download this
    $string =~ tr/\s'/_/d;