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
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 si.
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
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 si.
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.
- StringDrop[BioSequence["type","seq"],spec] applies the operation to the string "seq", yielding a biomolecular sequence.
- Given a circular BioSequence and a starting position greater than the ending position, i.e. m>n, then StringDrop[bioseq,{m,n}] drops the wrapped-around sequence starting at m and ending at n.
Examples
open all close allBasic Examples (3)
Drop the first 4 characters from a string:
StringDrop["abcdefghijklm", 4]Use InputForm to show quotes:
InputForm[%]Drop from the end of the string:
StringDrop["abcdefghijklm", -4]StringDrop["abcdefghijklm", {5, 10}]Scope (7)
Drop character 3 from a string:
StringDrop["abcdefghijklm", {3}]StringDrop["abcdefghijklm", {1, -1, 2}]Drop the last 2 characters from several strings:
StringDrop[{"abcdef", "xyzw", "stuv"}, -2]StringDrop works with special characters:
StringDrop["◆αβγ⟷𝒜ℬ𝒞↵", -4]Drop the first 4 characters if possible, else as many as are available:
StringDrop["abc", UpTo[4]]Drop a codon from a bio sequence:
StringDrop[BioSequence["DNA", "GTCTCGCGTAGC"], {4, 6}]Perform a wraparound drop on a bio sequence:
StringDrop[BioSequence["CircularDNA", "ACGT"], {4, 1}]Properties & Relations (3)
Newline (\n) counts as a single character:
StringDrop["abc
def", 4]StringDrop works like applying Drop to the list of characters:
Drop[Characters["abcdefghijklm"], {5, -4}]StringDrop["abcdefghijklm", {5, -4}]StringReplacePart with an empty string can be used like StringDrop:
StringReplacePart["abcdefghijk", "", {2, 5}]StringDrop["abcdefghijk", {2, 5}]StringReplacePart can drop several sequences of characters at a time:
StringReplacePart["abcdefghijk", "", {{2, 5}, {7, 8}, {-1, -1}}]Possible Issues (1)
StringDrop operates on the raw characters in a string:
StringDrop["red", 10]FullForm["red"]Tech Notes
Related Guides
History
Introduced in 1991 (2.0) | Updated in 1999 (4.0) ▪ 2000 (4.1) ▪ 2002 (4.2) ▪ 2004 (5.1) ▪ 2014 (10.0) ▪ 2015 (10.3) ▪ 2020 (12.2)
Text
Wolfram Research (1991), StringDrop, Wolfram Language function, https://reference.wolfram.com/language/ref/StringDrop.html (updated 2020).
CMS
Wolfram Language. 1991. "StringDrop." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringDrop.html.
APA
Wolfram Language. (1991). StringDrop. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringDrop.html
BibTeX
@misc{reference.wolfram_2026_stringdrop, author="Wolfram Research", title="{StringDrop}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringDrop.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_stringdrop, organization={Wolfram Research}, title={StringDrop}, year={2020}, url={https://reference.wolfram.com/language/ref/StringDrop.html}, note=[Accessed: 12-June-2026]}