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.htm
广告