View source: R/str_split_one.R
str_split_one | R Documentation |
Split a string
str_split_one(string, pattern, n = Inf)
string |
A character vector with, at most, one element. |
pattern |
Pattern to look for. The default interpretation is a regular expression, as described
in stringi::stringi-search-regex. Control options with
Match a fixed string (i.e. by comparing only bytes), using
Match character, word, line and sentence boundaries with
|
n |
number of pieces to return. Default (Inf) uses all possible split positions. For |
A character vector.
x <- "alfa,bravo,charlie,delta" str_split_one(x, pattern = ",") str_split_one(x, pattern = ",", n = 2) y <- "192.168.0.1" str_split_one(y, pattern = stringr::fixed("."))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.