VBScript LenFunction


VBScript 参考手册Complete VBScript Reference

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

Syntax

Len(string)

Parameters 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 above example is:

24

Try it yourself »

Example 2

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

<script type="text/vbscript">

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

</script>

The output of the above example is:

24

Try it yourself »

VBScript 参考手册Complete VBScript Reference Other Extensions