Answers

Question and Answer:

  Home  XQuery

⟩ Some elements on the web page I am testing contain leading (trailing) whitespaces. I am using the Utilities.Trim function to remove them, but sometimes it does not work. What is wrong?

There are several types of whitespace characters that can be used in HTML pages: “usual” spaces (with ASCII code 32), non-breaking spaces ( , code 160), end spaces ( , code 8194) and others. For more information on these characters, see the Whitespace and Formatting Characters article. The Utilities.Trim function only removes the “usual” spaces from the string. To remove other whitespaces, you can use the Utilities.StringReplace function to replace them with empty strings. For example, the code snippet below demonstrates how to remove non-breaking spaces from a string

 197 views

More Questions for you: