mid: Get a substring from the middle

View source: R/all.R

midR Documentation

Get a substring from the middle

Description

Inspired by the Excel function with the same name.

Usage

mid(string, start, length)

Arguments

string

a vector of strings

start

a vector of starting points (will be recycled, if needed)

length

a vector of lengths (will be recycled, if needed)

Value

The length characters of each value in string starting with the start character.

Examples

mid('lazy dog', 3, 2)
mid('lazy dog', 6, 3)
mid(c('lazy dog', 'blue dog'), 2, 2)
mid(c('lazy dog', 'red frog'), 6, c(3, 2))


adamleerich/alrtools documentation built on March 12, 2024, 11:38 p.m.