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


VBScript Join用法及代碼示例


一個函數,它返回一個字符串,該字符串包含數組中指定數量的子字符串。這是與拆分方法完全相反的函數。

用法

Join(List[,delimiter]) 
  • List, 必需參數。一個包含要連接的子字符串的數組。

  • delimiter,一個可選參數。字符,在返回字符串時用作分隔符。默認分隔符是空格。

示例

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         ' Join using spaces
         a = array("Red","Blue","Yellow")
         b = join(a)
         document.write("The value of b " & " is:"  & b & "<br />")

         ' Join using $
         b = join(a,"$")
         document.write("The Join result after using delimiter is:" & b & "<br />")

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

當上麵的代碼保存為 .html 並在 Internet Explorer 中執行時,它會產生以下結果 -

The value of b is:Red Blue Yellow
The Join result after using delimiter is:Red$Blue$Yellow

相關用法


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