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


gives a list of the ni^(th) characters in "string".


gives a list of the characters in "string" from the m^(th) through the n^(th) in steps of s.


gives the list of results for each of the si.


  • StringPart["string",-n] counts from the end to give the n^(th)-to-last character in "string".
  • StringPart gives each character as a string.
  • In StringPart["string",m;;n;;s], m, n, and/or s can be negative.
  • StringPart[BioSequence["type","seq"],spec] will apply the operation to the string "seq" yielding BioSequence results.


open allclose all

Basic Examples  (3)

Extract the sixth character in a string:

Use InputForm to show quotes:

Extract several characters from a string:

Extract a character from the end of a string:

Scope  (6)

Obtain the first six characters of a string:

Obtain a list of every other character:

Obtain a list of every other character, starting from the end of the string:

Get the first character of each of several strings:

Find the first and last characters:

StringPart works with special characters:

Extract single-letter sequences from a DNA sequence:

Properties & Relations  (7)

StringPart[str,{}] returns the empty list:

StringPart works like applying Part to the list of characters:

The characters in the list returned by StringPart can be turned into a string using StringJoin:

StringPart[str,n] is effectively equivalent to StringTake[str,{n}]:

StringPart[str,n;;m;;s] returns a list of characters:

StringTake[str,{n,m,s}] returns the same characters as a single string:

StringPart[str,All] is effectively equivalent to Characters[str]:

StringPart operates on the raw characters in a string:

Possible Issues  (1)

StringPosition gives results in a form suitable for StringTake, not StringPart:

Wolfram Research (2016), StringPart, Wolfram Language function, (updated 2020).


Wolfram Research (2016), StringPart, Wolfram Language function, (updated 2020).


Wolfram Language. 2016. "StringPart." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020.


Wolfram Language. (2016). StringPart. Wolfram Language & System Documentation Center. Retrieved from


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


@online{reference.wolfram_2024_stringpart, organization={Wolfram Research}, title={StringPart}, year={2020}, url={}, note=[Accessed: 26-May-2024 ]}