Home > Web Front-end > JS Tutorial > JavaScript method to remove symbols at the end of spliced ​​strings

JavaScript method to remove symbols at the end of spliced ​​strings

青灯夜游
Release: 2021-01-13 18:48:26
forward
2979 people have browsed it

JavaScript method to remove symbols at the end of spliced ​​strings

Preface: In JS, sometimes it is necessary to splice strings, and the spliced ​​strings are separated by certain symbols. At the end of the spliced ​​string There will be one more delimiter. In this case, we can use the following methods to remove the delimiter at the end.

For more programming-related knowledge, please visit: Programming Learning! !

Method 1: Use substring() and lastIndexOf()

Method 2: Use substring() and length Attribute

Method 3: Use regular expression

For more programming-related knowledge, please visit: Programming Learning! !

The above is the detailed content of JavaScript method to remove symbols at the end of spliced ​​strings. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
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