Home >Web Front-end >JS Tutorial >js string operation method example analysis_javascript skills

js string operation method example analysis_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:00:301310browse

The examples in this article describe js string operation methods. Share it with everyone for your reference. The details are as follows:

var str="This is my first Script code.";
document.write("原字符串为:"+str+"<br>")
document.write("第五个字符之后的部分:"+str.slice(5,-1)+"<br>");
document.write("第五个字符之后的15个字符:"+str.substr(5,15)+"<br>");
document.write("第五个字符后至第15个字符:"+str.substring(5,15)+"<br>");

I hope this article will be helpful to everyone’s JavaScript programming design.

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