Tuesday, May 8, 2012

VBScript Trim Function

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

<script type="text/vbscript">

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

</script>

The output of the code above will be:
HelloJackand welcome.

No comments: