VBScript Len 函數

Len 函數返回字串中的字元數量。
語法
Len(string)
參數 | 描述 |
---|---|
string | 字串運算式。 |
實例
實例 1
<script type="text/vbscript">
txt="This is a beautiful day!"
document.write(Len(txt))
</script>
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>
document.write(Len("This is a beautiful day!"))
</script>
以上實例輸出結果:
24
