Visual Basic Len 函数
定义和用法
Len 函数可返回字符串中字符的数目。
语法
Len(string|varname)
| 参数 | 描述 |
|---|---|
| string | 字符串表达式。 |
| varname | 变量名称。 |
实例
例子 1
Module Module1Sub Main()dim txttxt="This is a beautiful day!"Console.WriteLine(Len(txt))End SubEnd Module
输出:
24
例子 2
Module Module1Sub Main()Console.WriteLine(Len("This is a beautiful day!"))End SubEnd Module
输出:
24