Skip to content

String

String operations available in OCL expressions.

ConcatExpression

Returns a string that is the concatenation of self and s.

Signature

txt
String::concat (s : String) : String

Example

txt
self.name.concat("string")

IndexOfExpression

Returns the index of s in self, or 0 if not found.

Signature

txt
String::indexOf (s : String) : Number

Example

txt
self.name.indexOf("string")

SubstringExpression

Returns a substring from index start up to and including index end. Both parameters must be between 1 and self.size(). start cannot be greater than end.

Signature

txt
String::substring (start : Number, end : Number) : String

Example

txt
self.name.substring(0,2)

ToIntegerExpression

Tries to convert the string to an integer.

Signature

txt
String::toInteger () : Number

Example

txt
"3".toInteger()

ToLowerCaseExpression

Returns self as a lower case string.

Signature

txt
String::toLowerCase () : String

Example

txt
self.name.toLowerCase()

ToRealExpression

Tries to convert the string to a real number.

Signature

txt
String::toReal () : Number

Example

txt
"3.414".toReal()

ToUpperCaseExpression

Returns self as an upper case string.

Signature

txt
String::toUpperCase () : String

Example

txt
self.name.toUpperCase()

Released under the MIT License.