This is mainly applied to access to user input, to prevent users from accidentally, more than input a space, leading to validation can not pass, more for the user name and password, in many cases, we copy the WinRAR of the decompression password, will default more than one space, so this is to be noted.
It is a good habit for program developers to clean up the spaces before and after using trim when getting strings.
How to use:
Password=trim (Request ("password"))
Copy Code code as follows:
Dim txttxt= "This is a beautiful day! "
document.write (Trim (TXT))
Output: "This is a beautiful day!"
ASP LTrim function
The LTrim function returns a string with no leading spaces (LTrim)
Copy Code code as follows:
Dim txttxt= "This is a beautiful day! "
document.write (LTrim (TXT))
Output: "This is a beautiful day!"
ASP RTrim
The RTrim property returns a string with no subsequent spaces (RTrim)
Copy Code code as follows:
Dim txttxt= "This is a beautiful day! "
document.write (RTrim (TXT))
Output: "This is a beautiful day!"