String函数
String函数用指定的字符填充字符串指定的次数。
语法
String(number,character)
- number,必填参数。一个整数值,该值将针对character参数重复指定的次数。
- character,必需参数。字符值,必须重复指定的次数。
例
<!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> document.write("Line 1 :" & String(3,"$") & "<br />") document.write("Line 2 :" & String(4,"*") & "<br />") document.write("Line 3 :" & String(5,100) & "<br />") document.write("Line 4 :" & String(6,"ABCDE") & "<br />") </script> </body> </html>
将其另存为.html并在浏览器中执行时,上述脚本将产生以下结果:
Line 1 :$$$ Line 2 :**** Line 3 :ddddd Line 4 :AAAAAA
作者:terry,如若转载,请注明出处:https://www.web176.com/vbscript/1238.html