Search w3schools.com:

SHARE THIS PAGE

VBScript Len Function


VBScript Reference Complete VBScript Reference

The Len function returns the number of characters in a string.

Syntax

Len(string)

Parameter Description
string A string expression

Examples

Example 1

<script type="text/vbscript">

txt="This is a beautiful day!"
document.write(Len(txt))

</script>

The output of the code above will be:

24

Try it yourself »

Example 2

You can also put the string directly into the Len function:

<script type="text/vbscript">

document.write(Len("This is a beautiful day!"))

</script>

The output of the code above will be:

24

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]