StringEndsQ

StringEndsQ["string",patt]

yields True if the end of string matches the string pattern patt, and yields False otherwise.

StringEndsQ[{"string1","string2",},patt]

gives a list of the results for each of the stringi.

StringEndsQ[patt]

represents an operator form of StringEndsQ that can be applied to an expression.

Details and Options

  • The string expression patt can contain any of the objects specified in the notes for StringExpression.
  • Setting the option IgnoreCase->True makes StringEndsQ treat lowercase and uppercase letters as equivalent.
  • StringEndsQ[patt][expr] is equivalent to StringEndsQ[expr,patt].
  • StringEndsQ[BioSequence["type","seq"],patt] checks the end of the string "seq" against patt. In this case, degenerate letters in patt are interpreted as wildcard patterns based on the type of bio sequence. Use Verbatim["patt"] to match degenerate letters literally.
  • StringEndsQ has no special behavior for circular sequences, but instead interprets the end of the string as the designated end of the sequence.

Examples

open allclose all

Basic Examples  (4)

Check that a string ends with a given suffix:

Give a list of strings as input:

Specify a suffix using a string pattern:

Map the operator form over a list:

Use the operator form to select strings:

Scope  (3)

Check whether a bio sequence ends in a particular sequence:

Bio sequences can end with sequences matching degenerate letters:

Use Verbatim to avoid finding degenerate cases:

Options  (1)

IgnoreCase  (1)

Check a suffix regardless of case:

Wolfram Research (2015), StringEndsQ, Wolfram Language function, https://reference.wolfram.com/language/ref/StringEndsQ.html (updated 2020).

Text

Wolfram Research (2015), StringEndsQ, Wolfram Language function, https://reference.wolfram.com/language/ref/StringEndsQ.html (updated 2020).

BibTeX

@misc{reference.wolfram_2020_stringendsq, author="Wolfram Research", title="{StringEndsQ}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringEndsQ.html}", note=[Accessed: 22-January-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_stringendsq, organization={Wolfram Research}, title={StringEndsQ}, year={2020}, url={https://reference.wolfram.com/language/ref/StringEndsQ.html}, note=[Accessed: 22-January-2021 ]}

CMS

Wolfram Language. 2015. "StringEndsQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringEndsQ.html.

APA

Wolfram Language. (2015). StringEndsQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringEndsQ.html