split a string at designated characters
split a string at uppercase letters
split a string into equal length pieces
split a string at a fixed string
Split( s, sep )
CaseSplit( s )
LengthSplit( s, len )
LengthSplit( s, len, pad = ch )
StringSplit( s, fstr )
string; string to split
(optional) string; separator that indicates where to split string s
posint; the length of substrings into which s is to be split
character; character to use for padding the last string to length len
string; fixed string on which to split s
The Split(s, sep) command splits string s into substrings that are separated by the optional designated characters sep. If sep is not included in the calling sequence, string s is split on whitespace characters. A list of substrings of the input string s is returned.
The Split(s) form of the calling sequence is equivalent to
The characters that appear in the optional sep parameter are called separator characters (for the splitting operation). The substrings returned by Split(s, sep) are those obtained by taking all maximal substrings of s that do not contain a separator character.
Note: Each pair of consecutive separator characters in the input string cause an empty string to appear in the output. These can be filtered out.
The CaseSplit(s) command splits a string at uppercase letters. Each uppercase letter in the string begins a new string in the split list.
The LengthSplit command splits the string s into substrings of length len. An expression sequence of the substrings is returned. If len divides evenly into length⁡s, then each substring has length exactly len; otherwise, the last substring has length equal to irem⁡length⁡s,len.
If the pad option is provided in a call to LengthSplit, the last substring will be "padded" out to length len using the given character as padding.
If len is greater than or equal to length⁡s, then s is returned.
Note: LengthSplit⁡s,1 is equivalent to Explode⁡s.
The StringSplit( s, fstr ) command splits a string s at a fixed string fstr. This is equivalent to RegSplit( fstr, s ), but is much more efficient, and should therefore be preferred when fstr is a fixed string without regular expression metacharacters.
Split⁡This is a test.
L ≔ Split⁡This string has some extra whitespace
L ≔ This,string,has,some,,,,extra,,,whitespace,,,,,in,it.
Note the distinction between Split, which splits a string on a set of characters, and StringSplit, which splits a string on the entire string.
drseuss ≔ Think left and think right and think low and think high. Oh, the things you can think if only you try!:
Think left and , right and , low and , high. Oh, the things you can , if only you try!
T,,,, lef, a,d ,,,,, r,g,, a,d ,,,,, low a,d ,,,,, ,,g,. O,, ,,e ,,,,gs you ca, ,,,,, ,f o,ly you ,ry!
The StringTools[StringSplit] command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
Download Help Document
What kind of issue would you like to report? (Optional)
Thank you for submitting feedback on this help document. Your feedback will be used
to improve Maple's help in the future.