Returns a string that is the result of the concatenation of the current string and the string "b".
Expression | Result |
---|---|
'Hello'.add('World') | HelloWorld |
This operation behaves like '+' between two strings.
Returns a string that is the result of the concatenation of the current string and the string "b".
Expression | Result |
---|---|
'Hello'.concat('World') | HelloWorld |
This operation behaves like '+' between two strings.
Returns "true" if the current String contains the String "b"
Expression | Result |
---|---|
'Hello'.contains('llo') | true |
Returns true if the current String ends with the string "b".
Expression | Result |
---|---|
'Hello'.endsWidth('llo') | true |
Returns true if the current String is equals to the String "b" without considering case in the comparison.
Expression | Result |
---|---|
'Hello'.equalsIgnoreCase('hello') | true |
Returns the "n" first characters of the current String, or the current String itself if its size is less than "n".
Expression | Result |
---|---|
'HelloWorld'.first(5) | 'Hello' |
Returns the index of the first occurrence "subString" in the current String, or -1 if "subString" is not in the current String. The index referential is 1 as in OCL and not 0.
Expression | Result |
---|---|
'HelloHello'.index('Hello') | 1 |
Returns the index of the first occurrence "subString" in the current String from the given index, or -1 if "subString" is not in the current String. The index referential is 1 as in OCL and not 0.
Expression | Result |
---|---|
'HelloHello'.index('Hello', 2) | 6 |
Returns "true" if self consists only of alphabetical characters, "false" otherwise.
Expression | Result |
---|---|
'abc123'.isAlpha() | false |
'abcdef'.isAlpha() | true |
Returns "true" if self consists only of alphanumeric characters, "false" otherwise.
Expression | Result |
---|---|
'abc123'.isAlphaNum() | true |
'abcdef'.isAlphaNum() | true |
Returns the "n" last characters of the current String, or the current String if its size is less than "n".
Expression | Result |
---|---|
'HelloWorld'.last(5) | 'World' |
Returns the index of the last occurrence "subString" in the current String searching backward from the given index, or -1 if "subString" is not in the current String. The index referential is 1 as in OCL and not 0.
Expression | Result |
---|---|
'HelloHello'.lastIndex('Hello', 7) | 1 |
Returns the index of the last occurrence of "subString" in the current String, "-1" if the current String doesn't contain this particular substring. The index referential is 1 as in OCL and not 0.
Expression | Result |
---|---|
'HelloHello'.lastIndex('World') | 6 |
Returns "true" if the current String matches the given "regex".
Expression | Result |
---|---|
'Hello'.matches('*llo') | true |
Returns the current String prefixed with the given "prefix".
Expression | Result |
---|---|
'World'.prefix('Hello') | 'HelloWorld' |
Replaces the first substring of the current String that matches the regular expression "regex" with the String "replacement".
Expression | Result |
---|---|
'Hello'.replace('(.*)ll', 'Wh') | 'Who' |
Replaces each substring of the current String that matches the given regular expression "regex" with the String "replacement".
Expression | Result |
---|---|
'TestTest'.replace('.st', 'erminated') | 'TerminatedTerminated' |
Return the length of the current String.
Expression | Result |
---|---|
'HelloWorld'.size() | 10 |
Returns true if the current String starts with the string "b".
Expression | Result |
---|---|
'Hello'.startsWith('Hell') | true |
Returns an integer that is either negative, zero or positive depending on whether s1 is alphabetically less than, equal to or greater than self. Note that upper case letters come before lower case ones, so that 'AA' is closer to 'AC' than it is to 'Ab'.
Expression | Result |
---|---|
'strcmp operation'.strcmp('strcmp') | 10 |
'strcmp operation'.strcmp('strcmp operation') | 0 |
'strcmp operation'.strcmp('strtok') | -17 |
Searches r in self.
Expression | Result |
---|---|
'HelloWorld'.strstr('World') | true |
Substitutes the first occurrence of the substring "r" in self by "t" and returns the resulting string. Will return self if it contains no occurrence of the substring r.
Expression | Result |
---|---|
'WorldWorld'.substitute('World', 'Hello') | 'HelloWorld' |
Substitutes all occurences of the substring "r" in self by "t" and returns the resulting string. Will return self if it contains no occurrence of the substring r.
Expression | Result |
---|---|
'WorldWorld'.substituteAll('World', 'Hello') | 'HelloHello' |
Returns a string containing all characters from self starting from index lower up to index upper included. Both lower and upper parameters should be contained between 1 and self.size() included. Lower cannot be greater than upper.
Expression | Result |
---|---|
'HelloWorld'.substring(1, 5) | 'Hello' |
Returns a string containing all characters from self starting from index lower up to the end of the string included. The lower parameter should be contained between 1 and self.size() included. Lower cannot be greater than the size of the String.
Expression | Result |
---|---|
'HelloWorld'.substring(5) | 'World' |
'HelloWorld'.substring(1) | 'HelloWorld' |
Returns an integer of value equal to self
Expression | Result |
---|---|
'42'.toInteger() | 42 |
Returns the current String with all characters transformed to lower case.
Expression | Result |
---|---|
'HelloWorld'.toLower() | 'helloworld' |
Returns the self string with the first characters transformed to lower case.
Expression | Result |
---|---|
'HelloWorld'.toLowerFirst() | 'helloWorld' |
Returns a real of value equal to self
Expression | Result |
---|---|
'41.9'.toReal() | 41.9 |
Returns the current String with all characters transformed to upper case.
Expression | Result |
---|---|
'HelloWorld'.toUpper() | 'HELLOWORLD' |
Returns the current String with the first characters transformed to upper case.
Expression | Result |
---|---|
'helloworld'.toUpperFirst() | 'Helloworld' |
Splits the current String by using the given "delimiter" into a collection of String
Expression | Result |
---|---|
'a, b, c, d'.tokenize(', ') | ['a', 'b', 'c', 'd'] |
Splits the current String by whitespace delimiter into a collection of String
Expression | Result |
---|---|
'a, b, c, d'.tokenize() | ['a,', 'b,', 'c,', 'd'] |
Trims the given String.
Expression | Result |
---|---|
' Hello World '.trim() | 'Hello World' |