Remove the Spaces before and after.  

if a string "  ddd  dd  d " , through the Trim () as "ddd  dd  d".  

as above on both sides can remove redundant Spaces (including tabs), but can't get rid of the middle space.  
in PHP trim () function with ASP the trim () function USES the same, if you come into contact with ASP, then naturally.  
usage is simple, want to remove the Spaces to add the following variables:  
<? PHP 
echo  Trim ($variables);  
? >

in general use in dealing with the user's password.

to define and use the

<Html>
<Body>
<? PHP
$STR="Hello World!"
echo "Without trim:". $STR;
echo <BR/>"" ; "
echo With the trim:" trim ($STR);
? >
<Body>
<Html> Output:



Without trim: Hello World!
With trim: Hello World! HTML source:


example 2

<? PHP
$STR="\ r \ nHello World! \ r \ n";
echo "Without trim:". $STR;
echo <BR/>"" ; "
echo With the trim:" trim ($STR);
? >Output:



Without trim: Hello World!
With trim: Hello World! HTML

you might be interested in the article:

  • PHP trim removal of syntax and the definition of null character introduction
  • JavaScript trim removal String Spaces of three methods (with the code, rounding)
  • js trim functions to a space with regular collection
  • trim the performance of the prototype function the js regular expression
  • JavaScript trim to space function implementation code
  • JavaScript trim, ltrim, rtrim custom function
  • ReplaceTrim function of asp to realize filters out all the TAB in the characters and the carriage return and line feed code
  • enhanced the trim function JavaScript code
  • VBS tutorial: functions - ltrim and rtrim and trim
  • add trim to String object in JavaScript, ltrim, rtrim method
  • asp trim, ltrim, space function before and after the rtrim to


This concludes the body part