.trim()

Method returns a copy of the string for which the method is executed with leading and trailing white space removed.

Description of the method

Description: trim method returns a copy of the string for which the method is executed with leading and trailing white space removed.
Available for: string
Parameters:  -
Return type: string

Example

Context: HeaderType1
OCL: self.Id.trim() = "IdContent"
Description: The example rule executes trim to the <Id> element and compares the result to a string "IdContent".

 

The XML snippet below would pass this check. The example has some leading and trailing white space which gets removed and after that a string "IdContent" is left.

<Id>   IdContent   </Id>

The other snippet below however would not pass this check. The whitespace inside a string is left untouched.

<Id>Id Content</Id>