The string class in Java has a trim () to remove the space characters before and after the string, and the trim () method in jquery can delete the string before and after the character variable. But there is no corresponding trim () method in
The code is as follows
Trim has nothing to say about. It is nothing more than removing the first space. For modern browsers, it is just a simple regular expression/^ \ s + | \ s + $. It also supports Chinese spaces & nbsp; and so on. What \ s supports Chinese spaces? Yes.
Usually, when the form is validated, the text of the input box needs to be taken out of the string and trailing blanks.The current version of the browser is natively supported by the trim () method, and the previous version of JQ also implements
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.