StringDrop

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

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

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

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

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

DetailsDetails

  • StringDrop["string",UpTo[n]] removes n characters, or as many as are available.
  • StringDrop["string",{m,n,s}] drops characters m through n in steps of s.
  • StringDrop uses the standard Wolfram Language 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

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]=
Introduced in 1991
(2.0)
| Updated in 2015
(10.3)