String

String

The standard type String represents strings, which can be both ASCII or Unicode. String is itself an instance of the metatype PrimitiveType (from UML).

conformsTo OclComparable , OclSummable

Operations

=(object2 : OclSelf) : Boolean precedence: EQUALITY

<>(object2 : OclSelf) : Boolean precedence: EQUALITY

+(s : String) : String precedence: ADDITIVE

The concatenation of self and s.

at(i : Integer) : String invalidating

Queries the character at position i in self.

characters() : Sequence(String)

Obtains the characters of self as a sequence.

compareTo(that : OclSelf) : Integer

The comparison of self with that. -ve if less than, 0 if equal, +ve if greater than.

concat(s : String) : String

The concatenation of self and s.

endsWith(s : String) : Boolean

Returns true if self ends with the string s. Every string ends with the empty string.

equalsIgnoreCase(s : String) : Boolean

Queries whether s and self are equivalent under case-insensitive collation.

indexOf(s : String) : Integer

Queries the first index in self at which s is a substring of self, or zero if s is not a substring of self. The empty string is a substring of every string at index 1 (and also at all other indexes).

lastIndexOf(s : String) : Integer

Queries the last in self at which s is a substring of self, or zero if s is not a substring of self. The empty string is a substring of every string at index self-size()+1 (and also at all other indexes).

matches(regex : String) : Boolean

Use a regular expression match and return true if self matches regex, false otherwise.

replaceAll(regex : String, replacement : String) : String invalidating

Return a string derived from self by replacing all matches of regex by replacement.

replaceFirst(regex : String, replacement : String) : String invalidating

Return a string derived from self by replacing the first match of regex by replacement.

size() : Integer

The number of characters in self.

startsWith(s : String) : Boolean

Returns true if self starts with the string s. Every string starts with the empty string.

substituteAll(oldSubstring : String, newSubstring : String) : String

Return a string derived from self by replacing all occurrences of oldSubstring by newSubstring.

substituteFirst(oldSubstring : String, newSubstring : String) : String

Return a string derived from self by replacing the first occurrence of oldSubstring by newSubstring. Returns invalid if there is no first occurrence.

substring(lower : Integer, upper : Integer) : String invalidating

The sub-string of self starting at character number lower, up to and including character number upper. Character numbers run from 1 to self.size().

toBoolean() : Boolean invalidating

Converts self to a boolean value.

toInteger() : Integer invalidating

Converts self to an Integer value.

toLower() : String

This is a deprecated variant of toLowerCase() preserving compatibility with traditional Eclipse OCL behaviour.

toLowerCase() : String

Converts self to lower case, using the locale defined by looking up oclLocale in the current environment. Otherwise, returns the same string as self.

toReal() : Real invalidating

Converts self to a Real value.

toString() : String

Returns self.

toUpper() : String

This is a deprecated variant of toUpperCase() preserving compatibility with traditional Eclipse OCL behaviour.

toUpperCase() : String

Converts self to upper case, using the locale defined by looking up oclLocale in the current environment. Otherwise, returns the same string as self.

tokenize() : Sequence(String)

Partition self into a sequence substrings separated by any of space, line-feed, carriage-return, form-feed and horizontal-tab delimiters. The delimiters are omitted from the return.

tokenize(delimiters : String) : Sequence(String)

Partition self into a sequence substrings separated by characters in the delimiters. The delimiters are omitted from the return.

tokenize(delimiters : String, returnDelimiters : Boolean) : Sequence(String)

Partition self into a sequence substrings separated by characters in the delimiters. If returnDelimeters is true the returned sequence includes the delimiters, otherwise the delimiters are omitted.

trim() : String

Return self with leading and trailing whitespace removed.

>(s : OclSelf) : Boolean precedence: RELATIONAL

True if self is greater than s, using the locale defined by looking up oclLocale in the current environment.

<(s : OclSelf) : Boolean precedence: RELATIONAL

True if self is less than s, using the locale defined by looking up oclLocale in the current environment.

<=(s : OclSelf) : Boolean precedence: RELATIONAL

True if self is less than or equal to s, using the locale defined by looking up oclLocale in the current environment.

>=(s : OclSelf) : Boolean precedence: RELATIONAL

True if self is greater than or equal to s, using the locale defined by looking up oclLocale in the current environment.