Home > Web Front-end > JS Tutorial > How to extract the length of a certain () special string in js (detailed tutorial)

How to extract the length of a certain () special string in js (detailed tutorial)

亚连
Release: 2018-06-22 15:47:25
Original
991 people have browsed it

The editor below will share with you an example of using js to extract the length of a certain () special string. It has a good reference value and I hope it will be helpful to everyone. Let’s 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 is what I compiled for everyone. I hope it will be useful to you in the future. Everyone is helpful.

Related articles:

How to implement recording and playback recording functions in WeChat applet

Nuxt.js framework (detailed tutorial)

How to implement a rolling digital clock in JS CSS

How to implement a centered floating effect of images in JS

How to implement label scrolling switching in JS

How to implement the guessing number function in AngularJS

JS plug-in for Web forms (High-quality recommendation)

How to dynamically add to the list in jQuery

About optimization configuration issues in Webpack

How to build Electron applications in Webpack

Issues about unsafe image paths using Angular4

The above is the detailed content of How to extract the length of a certain () special string in js (detailed tutorial). 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