StringTakeDrop
StringTakeDrop["string",n]
gives a pair of strings containing the first n characters in "string" and the remaining characters.
StringTakeDrop["string",seq]
gives the pair {StringTake["string",seq],StringDrop["string",seq]}.
Details
- StringTakeDrop uses the standard sequence specification:
-
All all characters None no characters n characters 1 through n UpTo[n] characters 1 up to at most n, as available -n last n characters {n} character n only {m,n} characters m through n inclusive {m,n,s} characters m through n in steps of s - StringTakeDrop[{string1,string2,…},seq] returns {StringTakeDrop[string1,seq],StringTakeDrop[string2,seq],…}.
- StringTakeDrop[BioSequence["type","seq"],spec] will apply the operation to the string "seq", yielding a BioSequence result.
- Given a circular BioSequence and a starting position greater than the ending position, i.e. m>n, then StringTakeDrop[bioseq,{m,n}] takes the wrapped-around sequence starting at m and ending at n.
Examples
open allclose allBasic Examples (3)
Scope (5)
StringTakeDrop uses the standard sequence specification:
Take up to 8 characters in the first string, or as many as are available:
StringTakeDrop is listable in its first argument:
Take and drop a codon from a biomolecular sequence:
Undertake a wraparound take and drop on a circular sequence:
Applications (1)
Break a list of structured strings by given lengths:
This can also be achieved with StringTake using a list of sequence specs:
Properties & Relations (2)
StringTakeDrop is equivalent to a combination of StringTake and StringDrop:
StringTakeDrop does for strings what TakeDrop does for lists:
Text
Wolfram Research (2021), StringTakeDrop, Wolfram Language function, https://reference.wolfram.com/language/ref/StringTakeDrop.html (updated 2022).
CMS
Wolfram Language. 2021. "StringTakeDrop." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/StringTakeDrop.html.
APA
Wolfram Language. (2021). StringTakeDrop. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringTakeDrop.html