({{, (RefLink[StringTake, paclet:ref/StringTake])["string",n]
gives a string containing the first n characters in "string". }, {, (RefLink[StringTake, paclet:ref/StringTake])["string",-n]
gives the last n characters in "string". }, {, (RefLink[StringTake, paclet:ref/StringTake])["string",{n}]
gives the n(^th) character in "string". }, {, (RefLink[StringTake, paclet:ref/StringTake])["string",{m,n}]
gives characters m through n in "string". }, {, (RefLink[StringTake, paclet:ref/StringTake])["string",{(Subscript[spec, 1]),(Subscript[spec, 2]),…}]
gives a list of the substrings specified by the (Subscript[spec, i]).}, {, (RefLink[StringTake, paclet:ref/StringTake])[{(Subscript[s, 1]),(Subscript[s, 2]),…},spec]
gives the list of results for each of the (Subscript[s, i]). }})

OpenersNotesSection(Spacer1)Details

(RefLink[StringTake, paclet:ref/StringTake])["string",(RefLink[UpTo, paclet:ref/UpTo])[n]] gives n characters, or as many as are available.

(RefLink[StringTake, paclet:ref/StringTake])["string",{m,n,s}] gives characters m through n in steps of s.

(RefLink[StringTake, paclet:ref/StringTake]) uses the standard Wolfram Language sequence specification.

OpenersPrimaryExamplesSection(Spacer1)Examples  (13)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Take the first 6 characters in a string:

StringTake["abcdefghijklm",6]

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

InputForm[%]

Take from the end of the string:

StringTake["abcdefghijklm",-4]

Take characters 5 through 10:

StringTake["abcdefghijklm",{5,10}]

OpenersExampleSection1(Spacer1)Scope  (5)

Find character 6 in a string:

StringTake["abcdefghijklm",{6}]

InputForm[%]

Take every other character:

StringTake["abcdefghijklm",{1,-1,2}]

Take the last 2 characters from several strings:

StringTake[{"abcdef","stuv","xyzw"},-2]

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

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

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

StringTake["abc",UpTo[4]]

OpenersExampleSection2(Spacer1)Properties & Relations  (3)

Newline (\n) counts as a single character:

StringTake["abc\ndef",5]

(RefLink[StringTake, paclet:ref/StringTake]) can effectively do "part" extraction in strings:

Characters["abcdefghijklm"][[6]]

StringTake["abcdefghijklm",{6}]

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

Take[Characters["abcdefghijklm"],{5,-4}]

StringTake["abcdefghijklm",{5,-4}]

OpenersExampleSection3(Spacer1)Possible Issues  (2)

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

StringTake["abcdef",{1,0}]

FullForm[%]

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

StringTake["red",-20]

FullForm["red"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[StringPart, paclet:ref/StringPart])  ▪  (RefLink[Take, paclet:ref/Take])  ▪  (RefLink[StringDrop, paclet:ref/StringDrop])  ▪  (RefLink[StringPosition, paclet:ref/StringPosition])  ▪  (RefLink[StringStartsQ, paclet:ref/StringStartsQ])  ▪  (RefLink[StringPartition, paclet:ref/StringPartition])  ▪  (RefLink[FileNameTake, paclet:ref/FileNameTake])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Operations on Strings, paclet:tutorial/OperationsOnStrings])}, {▪(RefLinkPlain[Special Characters, paclet:tutorial/SpecialCharacters-StringsAndCharacters])}})}})

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

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/11-strings-and-text.html])(WebLink[: Strings and Text, https://www.wolfram.com/language/elementary-introduction/11-strings-and-text.html])}})}})