Home >Web Front-end >JS Tutorial >How to extract the length of a certain () special string in js (detailed tutorial)
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; }
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!