Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

instr

Position of the nth occurrence of a string in another one


Description

Returns the position of the nth occurrence of str2 in str1. Returns 0 if str2 is not found

Usage

instr(str1, str2, startpos = 1, n = 1)

Arguments

str1

main string in which str2 is to be found

str2

substring contained in str1

startpos

starting position in str1; default is 1

n

which occurrence is to be found; default is 1

Value

number representing the nth position of str2 in str1

Examples

library(survPen)

instr("character test to find the position of the third letter r","r",n=3)

survPen

Multidimensional Penalized Splines for Survival and Net Survival Models

v1.5.1
GPL-3 | file LICENSE
Authors
Mathieu Fauvernier [aut, cre], Laurent Roche [aut], Laurent Remontet [aut], Zoe Uhry [ctb], Nadine Bossard [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.