This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12370|Reply: 1

[JavaScript] Usage of JS (remove before and after spaces or remove all spaces).

[Copy link]
Posted on 4/26/2017 1:28:59 PM | | |

1. Remove all spaces before and after the string:
The code is as follows:
        
    If you use jQuery to use the $.trim(str) method directly, str means that you want to remove all the spaces before and after the string.

2. Remove all spaces in the string (including the middle space, you need to set the second parameter to g)
The code is as follows:
      




Previous:.net/c# NetEase News Crawler API Interface Collection [Source Code]
Next:QR code generation example
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com