Skip to contents

Backend Selection

charr_backend()
Select charr's string backend

Threading

charr_threads()
Set the number of worker threads
charr_chunks_per_worker() charr_min_chunk()
Tune how parallel work is divided

Detect Matches

str_detect()
Detect the presence/absence of a match
str_starts() str_ends()
Detect the presence/absence of a match at the start/end
str_like() str_ilike()
Detect a pattern in the same way as SQL's LIKE and ILIKE operators
str_which()
Find matching indices
str_subset()
Find matching elements
str_count()
Count number of matches
str_locate() str_locate_all()
Find location of match

Extract And Match

str_extract() str_extract_all()
Extract the complete match
str_match() str_match_all()
Extract components (capturing groups) from a match
word()
Extract words from a sentence
invert_match()
Switch location of matches to location of non-matches

Manage Lengths

str_length() str_width()
Compute the length/width
str_pad()
Pad a string to minimum width
str_trim() str_squish()
Remove whitespace
str_trunc()
Truncate a string to maximum width
str_wrap()
Wrap words into nicely formatted paragraphs

Mutate Strings

str_sub() `str_sub<-`() str_sub_all()
Get and set substrings using their positions
str_replace() str_replace_all()
Replace matches with new text
str_remove() str_remove_all()
Remove matched patterns
str_replace_na()
Turn NA into "NA"
str_reverse()
Reverse strings by code point
str_to_upper() str_to_lower() str_to_title() str_to_sentence()
Convert string to upper case, lower case, title case, or sentence case
str_to_camel() str_to_snake() str_to_kebab()
Convert between different types of programming case

Join And Split

str_c()
Join multiple strings into one string
str_flatten() str_flatten_comma()
Flatten a string
str_dup()
Duplicate a string
str_split() str_split_1() str_split_fixed() str_split_i()
Split up a string into pieces
str_glue() str_glue_data()
Interpolation with glue
str_interp() superseded
String interpolation

Order And Compare

str_order() str_rank() str_sort()
Order, rank, or sort a character vector
str_equal()
Determine if two strings are equivalent
str_unique()
Remove duplicated strings

Read And Convert

str_read_lines()
Read a text file as Unicode lines
str_write_lines()
Write a character vector as lines to a file
str_conv()
Specify the encoding of a string

Patterns And Modifiers

fixed() coll() regex() boundary()
Control matching behaviour with modifier functions
str_escape()
Escape regular expression metacharacters

Inspect And Data

str_view()
View strings and matches
sentences fruit words
Sample character vectors for practicing string manipulations

Package

charr charr-package
charr: String Processing Reimagined for 'ALTREP' Strings