VBScript TrimFunction
Complete VBScript Reference
The Trim function removes spaces on both sides of a string.
Tip:See also the LTrim and 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>
fname=" Jack "
document.write("Hello" & Trim(fname) & "and welcome.")
</script>
The above example outputs:
HelloJackand welcome.
Try it Yourself »
Complete VBScript Reference Other Extensions