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).

Details

  • 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.

Examples

open allclose all

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]=

Scope  (5)

Properties & Relations  (3)

Possible Issues  (1)

See Also

Drop  StringTake  StringTrim  StringPosition  StringReplacePart  FileNameDrop

Tutorials

Introduced in 1991
(2.0)
| Updated in 2015
(10.3)