method str.split
The pieces of the text between occurrences of sep (an empty piece for neighbouring separators); the text itself when sep does not occur.
Example:
fn main() io {
print("{"a,b,,c".split(",")}")
}Вывод
["a", "b", "", "c"]
Splits at every occurrence of sep.
Example:
fn main() io {
print("{"a,b,,c".split(",")}")
}Вывод
["a", "b", "", "c"]
pub(api) fn split(sep: str) -> List<str>Сложность. O(n).
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
sep | str |
Возвращает
List<str>
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/text.oxl:478