This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

StringTake

StringTake
gives a string containing the first n characters in .
StringTake
gives the last n characters in .
StringTake
gives the ^(th) character in .
StringTake
gives characters m through n in .
StringTake
gives a list of the substrings specified by the .
StringTake
gives the list of results for each of the .
  • StringTake gives characters m through n in steps of s.
  • StringTake uses the standard Mathematica sequence specification.
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:
Take the first 6 characters in a string:
In[1]:=
Click for copyable input
Out[1]=
Use InputForm to show quotes:
In[2]:=
Click for copyable input
Out[2]//InputForm=
 
Take from the end of the string:
In[1]:=
Click for copyable input
Out[1]=
 
Take characters 5 through 10:
In[1]:=
Click for copyable input
Out[1]=
Find character 6 in a string:
Take every other character:
Take the last 2 characters from several strings:
StringTake works with special characters:
Newline () counts as a single character:
StringTake can effectively do "part" extraction in strings:
StringTake works like applying Take to the list of characters:
Taking between positions 1 and 0 gives a zero-length string:
StringTake operates on the raw characters in a string:
New in 2 | Last modified in 6