Replace the nth occurrence of string with another string

str_replace_nth(x, pattern, replacement, n)

Arguments

x

string to search for pattern

pattern

pattern to search for

replacement

replacement string

n

the nth orrcurrences of pattern that will be replaced

Value

string