虾编

split() 方法用于把一个字符串分割成字符串数组

ASP下的用法:
dim text
text =”how are you doing today?”
shuzu= split(text,”")
for i=1 to UBound(shuzu)
response.Write(shuzu(i)&”<br/>”)
next
输出为:
how
are
you
doing
today?

JAVASCRIPT下的用法:

<script type=”text/javascript”>

var text = “how are you doing today?”

document.write(text.split(” “) + “<br/>”)

document.write(text.split(” “) + “<br/>”)

document.write(text.split(” “,3))

</script>

输出为:

how,are,you,doing,today?

h,o,w, ,a,r,e, ,y,o,u, ,d,o,i,n,g, ,t,o,d,a,y,?

how,are,you



1 条评论

  • (Required)
  • (Required, will not be published)

本站页面采用 HTML5 构建。建议使用 Google ChromeMozilla Firefox 的最新版本浏览本站。