home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / src / PHP / php.exe / CleanupSpaces.php < prev    next >
Encoding:
Text File  |  2001-07-03  |  994 b   |  30 lines

  1.     //**************************************
  2.     //     
  3.     // Name: CleanupSpaces
  4.     // Description:This simple function remo
  5.     //     ves all unnecessary spaces from a string
  6.     //     . It removes all whitespaces and spaces 
  7.     //     when there are more than one in a row.
  8.     // By: Nola Stowe
  9.     //
  10.     // Inputs:a string
  11.     //
  12.     // Returns:a string
  13.     //
  14.     // Assumes:Assumed it is given a string
  15.     //
  16.     //This code is copyrighted and has    // limited warranties.Please see http://
  17.     //     www.Planet-Source-Code.com/xq/ASP/txtCod
  18.     //     eId.358/lngWId.8/qx/vb/scripts/ShowCode.
  19.     //     htm    //for details.    //**************************************
  20.     //     
  21.     
  22.     //*********
  23.     // CleanupSpaces: Function for removing 
  24.     //     multiple spaces (more than 1 in row)
  25.     // leading, and trailing spaces
  26.     //*********
  27.     function CleanupSpaces($s) {
  28.     return trim(eregi_replace("[[:space:]]{2,}", " ", $s));
  29.     }
  30.