Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Altered:
Function [other Function type actions]
Item [operators of similar scope]
Data manipulation [other Data manipulation operators]
6.4.0
String.endsWith("string")
String.endsWith() returns true if the chained string ends with a specific substring.
For example, if $MyString is "I do not like green eggs and ham":
$MyString.endsWith("ham")
returns true
$MyString.endsWith("eggs")
returns false
Also, with string literals:
("There are gentlemen now abed.").endsWith("abed")
returns true
("There are gentlemen now abed.").endsWith("night")
returns false
This operator searches for literal strings, not regular expressions. Matches are case sensitive:
("There are gentlemen now abed.").endsWith("Abed")
returns false
See also String.beginsWith(). If you need to search a String for a regular expression, use String.contains().