({{, (RefLink[StringPart, paclet:ref/StringPart])["string",n] 
gives the n(^th) character in "string".}, {, (RefLink[StringPart, paclet:ref/StringPart])["string",{(Subscript[n, 1]),(Subscript[n, 2]),…}]
gives a list of the (Subscript[n, i])(^th) characters in "string".}, {, (RefLink[StringPart, paclet:ref/StringPart])["string",m;;n;;s]
gives a list of the characters in "string" from the m(^th) through the n(^th) in steps of s.}, {, (RefLink[StringPart, paclet:ref/StringPart])[{(Subscript[s, 1]),(Subscript[s, 2]),…},spec]
gives the list of results for each of the (Subscript[s, i]).}})

OpenersNotesSection(Spacer1)Details

(RefLink[StringPart, paclet:ref/StringPart])["string",-n] counts from the end to give the n(^th)-to-last character in "string".

(RefLink[StringPart, paclet:ref/StringPart]) gives each character as a string.

In (RefLink[StringPart, paclet:ref/StringPart])["string",m;;n;;s], m, n, and/or s can be negative.

OpenersPrimaryExamplesSection(Spacer1)Examples  (16)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Extract the sixth character in a string:

StringPart["abcdefghijlkm", 6]

Use (RefLink[InputForm, paclet:ref/InputForm]) to show quotes:

InputForm[%]

Extract several characters from a string:

StringPart["abcdefghijlkm", {1,3,5}]

Extract a character from the end of a string:

StringPart["abcdefghijlkm", -4]

OpenersExampleSection1(Spacer1)Scope  (5)

Obtain the first six characters of a string:

StringPart["abcdefghijklm",1;;6]

Obtain a list of every other character:

StringPart["abcdefghijklm",1;;-1;;2]

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

StringPart["abcdefghijklm",-1;;1;;-2]

Get the first character of each of several strings:

StringPart[{"abcd","efgh","ijklm"},1]

Find the first and last characters:

StringPart[{"abcd","efgh","ijklm"},{1,-1}]

(RefLink[StringPart, paclet:ref/StringPart]) works with special characters:

StringPart["◆αβγ⟷𝒜ℬ𝒞↵",-4]

OpenersExampleSection3(Spacer1)Properties & Relations  (7)

(RefLink[StringPart, paclet:ref/StringPart])[str,{}] returns the empty list:

StringPart["abcde",{}]

(RefLink[StringPart, paclet:ref/StringPart]) works like applying (RefLink[Part, paclet:ref/Part]) to the list of characters:

StringPart["abcdefghijklm",6]

Characters["abcdefghijklm"][[6]]

StringPart["abcdefghijklm",{1,3,5}]

Characters["abcdefghijklm"][[{1,3,5}]]

StringPart["abcdefghijklm",1;;-1;;2]

Characters["abcdefghijklm"][[1;;-1;;2]]

The characters in the list returned by (RefLink[StringPart, paclet:ref/StringPart]) can be turned into a string using (RefLink[StringJoin, paclet:ref/StringJoin]):

StringPart["abcdefghijklm",{1,3,7}]

StringJoin[%]

(RefLink[StringPart, paclet:ref/StringPart])[str,n] is effectively equivalent to (RefLink[StringTake, paclet:ref/StringTake])[str,{n}]:

StringPart["abcdefghijklm",6]

StringTake["abcdefghijklm",{6}]

(RefLink[StringPart, paclet:ref/StringPart])[str,n;;m;;s] returns a list of characters:

StringPart["abcdefghijklm",1;;5;;3]

(RefLink[StringTake, paclet:ref/StringTake])[str,{n,m,s}] returns the same characters as a single string:

StringTake["abcdefghijklm",{1,5,3}]

(RefLink[StringPart, paclet:ref/StringPart])[str,(RefLink[All, paclet:ref/All])] is effectively equivalent to (RefLink[Characters, paclet:ref/Characters])[str]:

StringPart["abcdef",All]===Characters["abcdef"]

(RefLink[StringPart, paclet:ref/StringPart]) operates on the raw characters in a string:

StringPart["red",-20;;-14]

FullForm["red"]

OpenersExampleSection4(Spacer1)Possible Issues  (1)

(RefLink[StringPosition, paclet:ref/StringPosition]) gives results in a form suitable for (RefLink[StringTake, paclet:ref/StringTake]), not (RefLink[StringPart, paclet:ref/StringPart]):

StringPosition["abcdefghijklm","fgh"]

StringTake["abcdefghijklm",{{6,8}}]

StringPart["abcdefghijklm",{{6,8}}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[StringTake, paclet:ref/StringTake])  ▪  (RefLink[Part, paclet:ref/Part])  ▪  (RefLink[Characters, paclet:ref/Characters])  ▪  (RefLink[StringPosition, paclet:ref/StringPosition])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[String Manipulation, paclet:guide/StringManipulation])}, {▪(RefLinkPlain[String Operations, paclet:guide/StringOperations])}})}})