TUTORIAL编程语言与算法FETCHED

VBScript Len 函数

VBScript Len 函数 完整的 VBScript 参考手册 Len 函数返回字符串中的字符数量。 语法 Len(string) 参数 描述 string 字符串表达式。 实例 实例 1 <script type='text/vbscript'> txt='This is a beautiful day!' ..

更新于 2026/7/16

教程详情页默认 noindex。

VBScript Len 函数


VBScript 参考手册 完整的 VBScript 参考手册

Len 函数返回字符串中的字符数量。

语法

Len(string)

参数 描述
string 字符串表达式。

实例

实例 1

<script type="text/vbscript">

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

</script>

以上实例输出结果:

24

尝试一下 »

实例 2

您还可以把字符串直接放入 Len 函数:

<script type="text/vbscript">

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

</script>

以上实例输出结果:

24

尝试一下 »

VBScript 参考手册 完整的 VBScript 参考手册