White space characters
- In JavaScript's regular, the \s is Unicode-aware, can match \u0020, \u0009 and so on white space character. However, the implementation of each browser is different, see also: JavaScript, Regex, and Unicode.
- In most cases, the JS class Library uses/^\s+|\s+$/g when implementing the Trim method.
- In JQuery, the detection of \U00A0 was added:/^ (\s|\u00a0) +| (\S|\U00A0) +$/g\u00a0 is actually Represents non-breaking space (uninterrupted space)
- Strictly semantically, usage scenarios are not expected to be used when auto-wrapping. But in reality, most of the cases, is used to denote pure spaces. Because more than one word spaces in the HTML will be treated as a space, in order to continuously output multiple spaces, had to use It is argued that multiple & #32 are used; outputting multiple spaces is the best choice, but the powerful HTML engine will still put multiple & #32; Converted into one.
JS: Remove space between the left and right sides of the string