Skip to contents

Extract a specific character from a string.

Usage

str_extract_char(string, char = 1)

Arguments

string

A character vector

char

A integer single value (default = 1), that will be the character position to be extracted

Value

A character vector.

Examples


str_extract_char(string = "abcdef")
#> [1] "a"

str_extract_char(string = "abcdef", char = 2)
#> [1] "b"