Join
VBScript Join 函数
Join 函数返回一个由数组中若干子字符串组成的字符串。
语法
Join(list[,delimiter])
参数 | 描述 |
---|---|
list | 必需。一维数组,其中包含需被连接的子字符串。 |
delimiter | 可选。用于在返回的字符串中分割子字符串的字符。默认是空格字符。 |
实例
分离一个数组中的项目,有和没有使用 delimeter 参数:
<script type="text/vbscript">
days=Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
document.write(Join(days) & "<br />")
document.write(Join(days,",") & "<br />")
document.write(Join(days," ### "))
</script>
days=Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
document.write(Join(days) & "<br />")
document.write(Join(days,",") & "<br />")
document.write(Join(days," ### "))
</script>
以上实例输出结果:
Sun Mon Tue Wed Thu Fri Sat
Sun,Mon,Tue,Wed,Thu,Fri,Sat
Sun ### Mon ### Tue ### Wed ### Thu ### Fri ### Sat
Sun,Mon,Tue,Wed,Thu,Fri,Sat
Sun ### Mon ### Tue ### Wed ### Thu ### Fri ### Sat