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],…}.
Examples
open allclose allBasic Examples (3)
Scope (3)
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:
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.
CMS
Wolfram Language. 2021. "StringTakeDrop." Wolfram Language & System Documentation Center. Wolfram Research. 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