left-trim
The left-trim function (see screenshot below) removes leading whitespace characters of a string. Whitespace includes space (U+0020), tab (U+0009), carriage return (U+000D), and line feed (U+000A) characters. For details about whitespaces, see the XML Recommendation.
About non-breaking spaces
The left-trim, right-trim, and normalize-space functions do not remove non-breaking spaces. One of the possible solutions could be to replace the non-breaking space character, whose decimal representation is 160, with the space character, whose decimal representation is 32. The mapping below shows that after the non-breaking space has been replaced, the trimmed SomeValue value will be mapped to the target.
If your source component is an Excel file, you can remove extra spaces in Excel using a combination of TRIM, CLEAN, and SUBSTITUTE functions. For details, see Removing Spaces and Nonprinting Characters from Text.
Languages
Built-in, C++, C#, Java.
Parameters
Name | Type | Description |
---|---|---|
string | xs:string | The input string. |