StringStartsQ

StringStartsQ["string",patt]

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

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

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

StringStartsQ[patt]

represents an operator form of StringStartsQ 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 StringStartsQ treat lowercase and uppercase letters as equivalent.
  • StringStartsQ[patt][expr] is equivalent to StringStartsQ[expr,patt].
  • StringStartsQ[BioSequence["type","seq"],patt] will check the start of the string "seq" against patt. In this case, degenerate letters in patt are interpreted as wildcard patterns based on the type of biomolecular sequence. Use Verbatim["patt"] to match degenerate letters literally.
  • The documentation for BioSequence lists the degenerate letters supported by each type of biomolecular sequence.
  • StringStartsQ has no special behavior for circular biomolecular sequences, but instead interprets the start of the string as the designated start of the sequence.

Examples

open allclose all

Basic Examples  (4)

Check that a string starts with a given prefix:

Give a list of strings as input:

Specify a prefix using a string pattern:

Map the operator form over a list:

Use the operator form to select strings:

Scope  (3)

Check whether a biomolecular sequence starts with a particular substring:

Use a wildcard in the pattern compared against a biomolecular sequence:

The "N" is a degenerate letter:

Check for literal degenerate letters using Verbatim:

Options  (1)

IgnoreCase  (1)

Match a prefix regardless of case:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2022_stringstartsq, author="Wolfram Research", title="{StringStartsQ}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringStartsQ.html}", note=[Accessed: 30-September-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_stringstartsq, organization={Wolfram Research}, title={StringStartsQ}, year={2020}, url={https://reference.wolfram.com/language/ref/StringStartsQ.html}, note=[Accessed: 30-September-2022 ]}