char.position: Find positions of a particular pattern.

Description Usage Arguments Value

Description

designed to find the position of a particular character in a string. Useful with substr function

Usage

1
char.position(x, pattern, position = 0, instance = 1)

Arguments

x

Character vector to search through

pattern

character string that the function will attempt to find in x

position

positive or negative integer used to modulate the position returned if pattern is found in x, char.position returns the exact position by default. -1 returns position before pattern and 1 returns position after pattern.

instance

positive integer used to modulate which instance of the pattern is returned. Default is first instance. Assign "last" to return last instance in string

Value

Number vector of position of pattern found, returns NA if not found


jtlandis/justinmisc documentation built on May 25, 2019, 8:18 a.m.