Replace multiple whitespace characters with single whitespace characters.
用单个空格字符替换多个空格字符。
You've seen metacharacters, such as \s, that match any whitespace characters.
您已经看到过匹配所有空格字符的元字符,例如 \s。
The second is the preserve whitespace option, which preserves the boundary whitespace characters found in the XML document.
第二个是preservewhitespace选项,将保留XML文档中的边界空格符。
Forgetting to include this option would cause the form to be altered (that is, boundary whitespace characters removed) before being stored in the database.
忘记包含该选项将导致表单在存储到数据库之前发生改变(即移除边界空格符)。
To specify how whitespace characters should be handled, we would use the whitespace constraint.
为了指定空白符的处理方式,我们可以使用空白符约束。
Although using a regex for this adds a bit of performance overhead, it lets you defer the list of whitespace characters to the browser for the sake of brevity and compatibility.
请注意,此方案在循环中使用正则表达式检测字符串尾部的字符是否空格,尽管使用正则表达式增加了一点性能负担,但它允许你根据浏览器定义空格字符列表,以保持简短和兼容性。
Although using a regex for this adds a bit of performance overhead, it lets you defer the list of whitespace characters to the browser for the sake of brevity and compatibility.
请注意,此方案在循环中使用正则表达式检测字符串尾部的字符是否空格,尽管使用正则表达式增加了一点性能负担,但它允许你根据浏览器定义空格字符列表,以保持简短和兼容性。
应用推荐