Skip to content

split ​

Split a string into a list.

Syntax ​

tcl
split string ?splitChars?

Parameters ​

  • string: The string to split
  • splitChars: Characters to split on (default: whitespace)

Description ​

Splits a string into a list of elements. Each character in splitChars is treated as a delimiter. If splitChars is an empty string, the string is split into individual characters.

Examples ​

Default split (whitespace) ​

Output

Split on specific character ​

Output

Split into characters ​

Output

Multiple delimiter characters ​

Output

Parsing CSV-like data ​

Output

See Also ​

  • join - Join list elements into string
  • string - String operations
  • list - Create a list