str.replace.at.pos: replace a string at the positions specified by pos

View source: R/stringtools.R

str.replace.at.posR Documentation

replace a string at the positions specified by pos

Description

replace a string at the positions specified by pos

Usage

## S3 method for class 'replace.at.pos'
str(str, pos, new, pos.mat.like.list = FALSE)

Arguments

str

a vector, or a single element

pos

a matrix of substring positions, or a list of such matrices if str is a vector

new

a vector of new strings for each substring position, or a list of such vectors if length(str)>1

Value

string (vector) of length(str) in which the substrings have been replaced

Examples

## Not run: 
  str = "1234567890"
  pos = rbind(c(7,7),c(4,5))
  new = c("XXX","...")
  str.replace.at.pos(str,pos,new)
  
  str = c("1234567890","ahgdasdajsdgadhsabd")
  str.replace.at.pos(str,pos,new)          

## End(Not run)

skranz/stringtools documentation built on May 11, 2022, 4:48 a.m.