Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.1.0 - Português


tokens

Divide um texto usando separadores e fornece seus pedaços

Seqüência de Chamamento

Chunks = tokens(text)
Chunks = tokens(text, separators)

Parâmetros

text
Um único texto a ser dividido. Pode incluir caracteres internacionais UTF-8 estendidos.

separators
Vetor de caracteres. Valor padrão = [" ",ascii(9)], ascii(9) sendo a tabulação horizontal.

Chunks
Vetor da coluna: partes do texto dividido.

Descrição

tokens(…) pesquisa no texto os separadores fornecidos, e divide em pedaços. Os pedaços são sem separadores. Separadores consecutivos são mesclados.

Exemplos

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"

Ver Também

  • strsplit — split a single string at some given positions or patterns
  • regexp — acha um string que corresponde ao string de expressão regular
  • strindex — procura posição de um string em outro
  • tokenpos — retorna as posições das fichas (token) em um string
Report an issue
<< tokenpos Cadeias de Caracteres (Strings) Manipulação de Arquivos de Som >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon May 22 12:42:14 CEST 2023