VBScript Join Function

Advertisements


Join :

A Function, which returns a String that contains a specified number of substrings in an array. This is an exact opposite function of Split Method.

Syntax :

Join(List[,delimiter]) 
  1. List, a Required parameter. An Array that contains the substrings that are to be joined.

  2. delimiter, an Optional Parameter. The Character, which used as a delimiter while returning the string. The Default delimiter is Space.

Example :

<!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>

When the above code is saved as .html and executed in Internet Explorer, it produces the following result:

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


Advertisements
Advertisements