Home > Web Front-end > JS Tutorial > js example of extracting the length of a certain () special string_javascript skills

js example of extracting the length of a certain () special string_javascript skills

韦小宝
Release: 2017-12-16 14:33:15
Original
1649 people have browsed it

The following editor will share with you an example of extracting the length of a certain ()special character string with js. It has a good reference value and I hope it will be helpful to everyone in learning js. Friends who are interested in js, please follow the editor to take a look.

The example is as follows:


// 提取特殊字符串长度(scrstr 源字符串 armstr 特殊字符)
getStrCount: function(scrstr, armstr) {
 var count = 0;
 while (scrstr.indexOf(armstr) >= 1) {
  scrstr = scrstr.replace(armstr, "")
  count++;
 }
 return count;
}
Copy after login


The above example of JS extracting the length of a certain () special string is all the content shared by the editor. I hope it can give you a reference, and I also hope you will support PHP more. Chinese website.

Related recommendations:

js Example of removing duplicate values ​​from two arrays_javascript skills

A brief analysis of the JS abstract factory pattern_

js implements the JD Express upward scrolling function

The above is the detailed content of js example of extracting the length of a certain () special string_javascript skills. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template