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!