Home  >  Article  >  Web Front-end  >  JS string segmentation usage examples_javascript skills

JS string segmentation usage examples_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:14:281313browse

The example in this article describes the usage of JS string segmentation. Share it with everyone for your reference, the details are as follows:

<script type="text/javascript">
<!--
var str="x:1;y:2;z:3";
var sarry=new Array(str.length,2);
var fsa=str.split(";");
for(i=0;i<fsa.length;i++)
{
var temp=fsa[i].split(":");
alert(temp);
alert(temp[0]);
sarry[i,0]=temp[0];
sarry[i,1]=temp[1];
alert(sarry[i,0]);
}
// -->
</script>

Readers who are interested in more JavaScript-related content can check out the special topics on this site: "Summary of JavaScript search algorithm techniques", "Summary of JavaScript animation special effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm techniques", "Summary of JavaScript traversal algorithms and techniques" and "JavaScript Mathematics Summary of operation usage

I hope this article will be helpful to everyone in JavaScript programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn