Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Programming / String Manipulation  /
StringTake

  • StringTake[" string ", n ] gives a string containing the first n characters in " string ".
  • StringTake[" string ", - n ] gives the last n characters in " string ".
  • StringTake[" string ", n ] gives the n character in " string ".
  • StringTake[" string ", m , n ] gives characters m through n in " string ".
  • StringTake uses the standard sequence specification (see Section A.3.5).
  • Example: StringTake["abcdefg", 3].
  • See the Mathematica book: Section 2.7.2.
  • See also: Take, StringDrop, StringPosition.

    Further Examples

    This takes four characters starting from the end of the string.

    In[1]:=

    Out[1]=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.