# StrAfterNth

0th

Percentile

##### Text before or after $n$th occurrence of pattern.

Extract the part of a string which is before or after the $n$th occurrence of a specified pattern, vectorised over the string. One can also choose $n$ to be the last occurrence of the pattern. See argument n.

##### Usage
StrAfterNth(strings, pattern, n)StrBeforeNth(strings, pattern, n)
##### Arguments
strings

A character vector.

pattern

A regular expression.

n

A natural number to identify the $n$th occurrence This can be negatively indexed, so if you wish to select the last occurrence, you need n = -1, for the second-last, you need n = -2 and so on.

##### Value

A character vector of the desired strings.

• StrAfterNth
• StrBeforeNth
##### Examples
string <- "ab..cd..de..fg..h"
StrAfterNth(string, "\\.\\.", 3)
StrBeforeNth(string, "e", 1)
StrBeforeNth(string, "\\.", -3)
StrBeforeNth(string, ".", -3)
StrBeforeNth(rep(string, 2), fixed("."), -3)

Documentation reproduced from package filesstrings, version 0.4.0, License: GPL-3

### Community examples

Looks like there are no examples yet.