VBScript Len 函数

Len

Len 函数返回给定输入字符串的长度(包括空格)。

语法

Len(String)

示例

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         var1 = "Microsoft VBScript"
         document.write("Length of var1 is : " & Len(var1) & "<br />")

         var2 = "Microsoft VBScript"
         document.write("Length of var2 is : " & Len(var2) & "<br />")

      </script>
   </body>
</html>

当您将其另存为 .html 并在 Internet Explorer 中执行时,上述脚本将产生以下结果 −

Length of var1 is : 18
Length of var2 is : 36

vbscript_strings.html