Scilab-Branch-6.1-GIT
- Aide de Scilab
- Chaînes de caractères
- ascii
- asciimat
- blanks
- char
- convstr
- emptystr
- evstr
- grep
- isalphanum
- isascii
- isdigit
- isletter
- isnum
- justify
- length
- part
- prettyprint
- regexp
- sci2exp
- strcat
- strchr
- strcmp
- strcspn
- strindex
- string
- stripblanks
- strncpy
- strrchr
- strrev
- strsplit
- strspn
- strstr
- strsubst
- strtod
- strtok
- tokenpos
- tokens
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
tokens
Splits a string using separators and gives its chunks
Syntax
Chunks = tokens(str) Chunks = tokens(str, separators)
Arguments
- str
- A single string to be split. It can include extended UTF-8 international characters.
- separators
- Vector of characters. Default value =
[" ", ascii(9)]
, ascii(9) being the horizontal tab. - Chunks
- Column vector: Pieces of the split string.
Description
tokens(…)
searches the string for given separator(s),
and splits it into chunks. Chunks are free of separators.
Consecutive separators are merged.
Examples
tokens("The given text") tokens("SCI/demos/scicos", "/")' tokens("Επιστήμη και καινοτομία", ["α"," "])' nbsp = ascii(160); // non-breakable space t = "the" + nbsp + "given text" tokens(t)
--> tokens('The given text') ans = "The" "given" "text" --> tokens('SCI/demos/scicos', '/')' ans = "SCI" "demos" "scicos" --> tokens("Επιστήμη και καινοτομία", ["α"," "])' ans = "Επιστήμη" "κ" "ι" "κ" "ινοτομί" --> nbsp = ascii(160); // non-breakable space --> t = "the" + nbsp + "given text" t = "the given text" --> tokens(t) ans = "the given" "text"
See also
Report an issue | ||
<< tokenpos | Chaînes de caractères | Sons - fichiers audio >> |