Search w3schools.com:

SHARE THIS PAGE

VBScript Trim Function


VBScript Reference Complete VBScript Reference

The Trim function removes spaces on both sides of a string.

Tip: Also look at the LTrim and the RTrim functions.

Syntax

Trim(string)

Parameter Description
string Required. A string expression

Example

Example

<script type="text/vbscript">

fname=" Jack "
document.write("Hello" & Trim(fname) & "and welcome.")

</script>

The output of the code above will be:

HelloJackand welcome.

Try it yourself »

VBScript Reference Complete VBScript Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]