當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


VBScript String用法及代碼示例


字符串函數用指定的字符填充字符串指定的次數。

用法

String(number,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 並在 Internet Explorer 中執行它時,那麽上麵的腳本將產生以下結果——

Line 1:$$$
Line 2:****
Line 3:ddddd
Line 4:AAAAAA

相關用法


注:本文由純淨天空篩選整理自 VBScript String Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。