VBScript Trim Function



Trim

The Trim Function removes both the Leading and Trailing blank spaces of the given input string.

Syntax

Trim(String)

Example

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         var = "Microsoft VBScript"
         document.write("After Trim : " & Trim(var) & "<br />")

      </script>
   </body>
</html>

When you save it as .html and execute it in Internet Explorer, then the above script will produce the following result −

After trim : Microsoft VBScript
vbscript_strings.htm
Advertisements