Split up a String By Fixed Pattern Matches

Share:

Description

Splits each element of str into substring. pattern indicates delimiters that separate the input into fields. The input data between the matches become the fields themselves.

Usage

1
2
stri_split_fixed(str, pattern, n_max = -1L, omit_empty = FALSE,
  opts_collator = list())

Arguments

str

character vector with strings to search in

pattern

character vector with fixed patterns

n_max

integer vector, maximal number of pieces to return

omit_empty

logical vector; determines whether empty strings should be removed from the result

opts_collator

a named list as generated with stri_opts_collator with Collator options, or NA for fast but locale-unaware byte comparison

Details

Vectorized over str, pattern, n_max, and omit_empty.

If n_max is negative (default), then all pieces are extracted.

omit_empty is applied during splitting: if set to TRUE, then empty strings will never appear in the resulting vector.

Pass opts_collator that is equal to NA for a much faster, but locale unaware, (exact) bitwise string comparisons. For natural language text, however, this may not be what you really want.

Value

Returns a list of character vectors.

See Also

Other locale_sensitive: stri_cmp, stri_compare; stri_count_fixed; stri_detect_fixed; stri_enc_detect2; stri_locate_all_fixed, stri_locate_all_fixed,, stri_locate_first_fixed, stri_locate_first_fixed,, stri_locate_last_fixed, stri_locate_last_fixed; stri_opts_collator; stri_order, stri_sort; stri_replace_all_fixed, stri_replace_all_fixed, stri_replace_first_fixed, stri_replace_first_fixed, stri_replace_last_fixed, stri_replace_last_fixed; stri_trans_tolower, stri_trans_totitle, stri_trans_toupper; stringi-locale; stringi-search-fixed

Other search_fixed: stri_count_fixed; stri_detect_fixed; stri_extract_all_fixed, stri_extract_all_fixed,, stri_extract_first_fixed, stri_extract_first_fixed,, stri_extract_last_fixed, stri_extract_last_fixed; stri_locate_all_fixed, stri_locate_all_fixed,, stri_locate_first_fixed, stri_locate_first_fixed,, stri_locate_last_fixed, stri_locate_last_fixed; stri_opts_collator; stri_replace_all_fixed, stri_replace_all_fixed, stri_replace_first_fixed, stri_replace_first_fixed, stri_replace_last_fixed, stri_replace_last_fixed; stringi-search-fixed; stringi-search

Other search_split: stri_split_charclass, stri_split_charclass; stri_split_lines, stri_split_lines, stri_split_lines1, stri_split_lines1; stri_split_regex, stri_split_regex; stri_split; stringi-search

Examples

1
2
3
4
## Not run: 
stri_split_fixed("Lorem ipsum dolor sit amet", " ")

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.