String Operators
Here is a list of all string operators available to use in simple expressions.
String Operator | Description | Simple Expression | Result |
---|---|---|---|
+ |
String concatenation |
"pine" + "apple" |
"pineapple" |
== |
Equals |
"apples" == "apples" |
true |
!= |
Not Equals |
"apples" != "oranges" |
true |
> |
Greater than |
"word" > "work" |
false |
>= |
Greater than or Equals |
"work" >= "work" |
true |
< |
Less than |
"word" < "work" |
true |
<= |
Less than or Equals |
"work" <= "work" |
true |
contains |
Returns true if the first argument string contains the second argument string; otherwise, returns false. |
"caramel".contains("ram") |
true |
endsWith |
Returns true if the first argument string ends with the second argument string; otherwise, returns false. |
"immutable".endsWith("table") |
true |
length |
Returns the number of characters in a string. |
"house".length() |
5 |
lowerCase |
Returns a string with all the characters in the argument converted to lower-case representation. |
"Example".lowerCase() |
"example" |
startsWith |
Returns true if the first argument string starts with the second argument string; otherwise, returns false. |
"caramel".startsWith("car") |
true |
substring |
Returns the substring of the first argument starting at the position specified in the second argument and continuing to the end of the string. |
"care".substring(1) |
"are" |
substring |
Returns the substring of the first argument starting at the position specified in the second argument and continuing to the end of the string. |
"care".substring(1) |
"are" |
Returns the substring of the first argument starting at the position specified in the second argument with length specified in the third argument. |
"care".substring(0,3) |
"car" |
|
upperCase |
Returns a string with all the characters in the argument converted to upper-case representation. |
"Example".upperCase() |
"EXAMPLE" |