You can use toLower() in OCL or EAL to return a string with its characters converted to lowercase, for example when preparing text for a case-independent comparison.
Syntax
<string-expression>.toLower()
The operator returns a new String value. It does not change the source attribute or variable.
Example
The following expression converts the text literal 'MDriven Designer' to lowercase:
'MDriven Designer'.toLower()
Result:
'mdriven designer'
Here are additional examples of the toLower() function in action:
| Expression | Result |
|---|---|
| 'LoWeR OpErAtIoN'.toLower() | 'lower operation' |
Compare text without case differences
Convert both values before comparing them when uppercase and lowercase characters should be treated as equivalent:
self.Name.toLower() = 'anna'
For example, if self.Name is 'ANNA', the expression evaluates to true.
Related string operations
Use toLower() when you need lowercase output. Use toUpper() when you need uppercase output instead.
