Skip to content

StringEndsQ

Status: Stable

documented, exercised by the test suite and/or worked examples, with no known limitations recorded.

Description

StringEndsQ["string", patt]

Gives True if a suffix of "string" matches the string expression patt, and False otherwise.

StringEndsQ["string", {p1, p2, ...}]

Gives True if a suffix matches any of the pi.

StringEndsQ[{s1, s2, ...}, patt]

Gives the list of results for each of the si.

StringEndsQ[patt]

Represents an operator form that can be applied to a string. Equivalent to StringContainsQ["string", patt ~~ EndOfString]. Options: IgnoreCase -> True treats upper/lowercase as equivalent.

Examples (4)

Every input below was run against the current Mathilda build and its output recorded.

Basic examples (4)

In[1]:= StringEndsQ["commit", "it"]
Out[1]= True

In[2]:= StringEndsQ["commit", "mi"]
Out[2]= False

In[3]:= StringEndsQ[{"apple", "banana"}, "a"]
Out[3]= {False, True}

In[4]:= StringEndsQ["a123", DigitCharacter ..]
Out[4]= True

Implementation notes

Attributes: Protected.

References