Scilab-Branch-6.1-GIT
- Справка Scilab
- Строки
- 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 2026.0.0. This page might be outdated.
See the recommended documentation of this function
tokens
Делит текст, используя разделители и выдаёт его части.
Синтаксис
Chunks = tokens(text) Chunks = tokens(text, separators)
Аргументы
- text
- Единый текст для разделения. Он может включать в себя расширенные международные символы UTF-8.
- separators
- Вектор символов. По умолчанию значение равно
[" ", ascii(9)], ascii(9) - это горизонтальная табуляция. - Chunks
- Вектор-столбец: части разделённого текста.
Описание
tokens(…) ищет текст для указанных разделителей и делит его на части.
Части свободны от разделителей. Последовательные разделители объединены.
Примеры
tokens("The given text") tokens("SCI/demos/scicos", "/")' tokens("Επιστήμη και καινοτομία", ["α"," "])' nbsp = ascii(160); // неразрывный пробел 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); // неразрывный пробел
--> t = "the" + nbsp + "given text"
t =
"the given text"
--> tokens(t)
ans =
"the given"
"text"
Смотрите также
| Report an issue | ||
| << tokenpos | Строки | Sound file handling >> |