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