WLJS LogoWLJS Notebook

StringEndsQ

StringEndsQ["string", patt] yields True if the end of the string matches the pattern.

StringEndsQ[patt] represents an operator form.

Examples

Check suffix:

StringEndsQ["Hello World", "World"]
(* True *)
StringEndsQ["Hello World", "Hello"]
(* False *)

Filter by file extension:

Select[{"file.txt", "image.png", "data.txt"}, StringEndsQ[".txt"]]
(* {"file.txt", "data.txt"} *)

Please visit the official Wolfram Language Reference for more details.

On this page