gives a string containing the first n characters in "string".


gives the last n characters in "string".


gives the n ^(th) character in "string".


gives characters m through n in "string".


gives a list of the substrings specified by the speci.


gives the list of results for each of the si.


  • StringTake["string",UpTo[n]] gives n characters, or as many as are available.
  • StringTake["string",{m,n,s}] gives characters m through n in steps of s.
  • StringTake uses the standard Wolfram Language sequence specification.
  • StringTake[BioSequence["type","seq"],spec] will apply the operation to the string "seq", yielding a BioSequence result.
  • Given a circular BioSequence and a starting position greater than the ending position, i.e. m>n, then StringTake[bioseq,{m,n}] takes the wrapped-around sequence starting at m and ending at n.


open allclose all

Basic Examples  (3)

Take the first 6 characters in a string:

Use InputForm to show quotes:

Take from the end of the string:

Take characters 5 through 10:

Scope  (7)

Find character 6 in a string:

Take every other character:

Take the last 2 characters from several strings:

StringTake works with special characters:

Take the first 4 characters if possible, else as many as are available:

Take a codon from a biomolecular sequence:

Perform a wraparound take on a circular sequence:

Properties & Relations  (3)

Newline (\n) counts as a single character:

StringTake can effectively do "part" extraction in strings:

StringTake works like applying Take to the list of characters:

Possible Issues  (2)

Taking between positions 1 and 0 gives a zero-length string:

StringTake operates on the raw characters in a string:

Wolfram Research (1991), StringTake, Wolfram Language function, (updated 2020).


Wolfram Research (1991), StringTake, Wolfram Language function, (updated 2020).


Wolfram Language. 1991. "StringTake." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020.


Wolfram Language. (1991). StringTake. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_stringtake, author="Wolfram Research", title="{StringTake}", year="2020", howpublished="\url{}", note=[Accessed: 24-May-2024 ]}


@online{reference.wolfram_2024_stringtake, organization={Wolfram Research}, title={StringTake}, year={2020}, url={}, note=[Accessed: 24-May-2024 ]}