Navigation

Operators and Keywords

Function List:

C++ API

Function File: [cstr] = strsplit (s, sep)

Function File: [cstr] = strsplit (s, sep, strip_empty)

Split the string s using one or more separators sep and return a cell array of strings. Consecutive separators and separators at boundaries result in empty strings, unless strip_empty is true. The default value of strip_empty is false.

2-D character arrays are split at separators and at the original column boundaries.

Example:

          strsplit ("a,b,c", ",")
                 ⇒
                    {
                      [1,1] = a
                      [1,2] = b
                      [1,3] = c
                    }
          
          strsplit (["a,b" ; "cde"], ",")
                 ⇒
                    {
                      [1,1] = a
                      [1,2] = b
                      [1,3] = cde
                    }

See also: strtok