StringDrop

StringDrop["string", n]
gives with its first n characters dropped.

StringDrop["string", -n]
gives with its last n characters dropped.

StringDrop["string", {n}]
gives with its n^(th) character dropped.

StringDrop["string", {m, n}]
gives with characters m through n dropped.

StringDrop[{s1, s2, ...}, spec]
gives the list of results for each of the .

DetailsDetails

  • StringDrop["string", {m, n, s}] drops characters m through n in steps of s.
  • StringDrop uses the standard Mathematica sequence specification.

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

Drop the first 4 characters from a string:

In[1]:=
Click for copyable input
Out[1]=

Use InputForm to show quotes:

In[2]:=
Click for copyable input
Out[2]//InputForm=

Drop from the end of the string:

In[1]:=
Click for copyable input
Out[1]=

Drop characters 5 through 10:

In[1]:=
Click for copyable input
Out[1]=
New in 2 | Last modified in 5.1
New to Mathematica? Find your learning path »
Have a question? Ask support »