OCLOperators ToUpper () : String
This page was created by Peter on 2019-11-22. Last edited by Wikiadmin on 2026-07-29.
You can use ToUpper() in an OCL expression to return an uppercase version of a string; use it when you need text in uppercase in an expression result.
Syntax
<string>.ToUpper()
Example
The following expression returns the text with its characters converted to uppercase:
'Hello World'.ToUpper()
Result:
'HELLO WORLD'
Use with an attribute
If self.Name contains 'Ada Lovelace', use:
self.Name.ToUpper()
The expression returns 'ADA LOVELACE'.
Related string operations
Use ToLower() when you need lowercase text instead. Use asString when the value is not already a string and you need its string representation before applying string operations.
