str_sub: Extract substrings

View source: R/sub.R

str_subR Documentation

Extract substrings

Description

Extract substrings

Usage

str_sub(string, start = 1L, end = -1L)

Arguments

string

Character vector of strings.

start, end

Integer vectors specifying start and end positions (inclusive). Negative values count backwards from the right hand side; -1 refers to the last character.

Instead of separate start and end parameters you can alternatively provide a two-column matrix (i.e. from str_locate()); the first column will be used for the starting position and the second for the ending position.


hadley/stringb documentation built on Sept. 16, 2023, 9:11 p.m.