Skip to content

strsplit

strings · scripts/strings/strsplit.m

: c = strsplit (s)
: c = strsplit (s, del)
: c = strsplit (…, "CollapseDelimiters", tf)
: c = strsplit (…, "DelimiterType", type)
: [c, matches] = strsplit (…)

Cut the char row s into pieces at delimiters.

del is one delimiter string (default a single space; backslash escapes in it are expanded) or a cell array of them. With "CollapseDelimiters" true (the default) runs of adjacent delimiters count as one. With "DelimiterType" "RegularExpression" the delimiters are regular expressions. The second output lists the delimiter text found at each split.