About JavaScript submission to Java background space to not lose the ASCII 160 solution

Source: Internet
Author: User

Today the regular expression matches a string, so it's not right.

Use regular expressions to remove the attempt str.replaceall ("\\s*", "" "); Remove the Str.replaceall ("", "") in either ReplaceAll ("\\s+", "") or String method;

These methods are not going to go off, and began to try to find his ASCII code, found to be 160. And then it suddenly occurred to me that 160 and 32 weren't all spaces? Then I looked up and said to use the following method can be:

  

String.replaceall ("\\u00A0", "" ")

is not a good pit, and then when you use in IE or Firefox when you find that in IE, 160 spaces do not display, in Firefox can be displayed.

Also, be careful when saving files:


This will remove illegal characters.

About JavaScript submission to Java background space to not lose the ASCII 160 solution

Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.