Vbscript-join-function

提供:Dev Guides
移動先:案内検索

VBScript結合関数

配列内の指定された数の部分文字列を含む文字列を返す関数。 これは、Split Methodの正反対の機能です。

構文

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>

上記のコードがlとして保存され、Internet Explorerで実行されると、次の結果が生成されます-

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