str.split: Splits string vectors

View source: R/stringtools.R

str.splitR Documentation

Splits string vectors

Description

Splits string vectors

Usage

## S3 method for class 'split'
str(str, pattern, first = FALSE, keep.match = FALSE, ...)

Arguments

str

a vector of strings

pattern

vector where splits take place

Value

A list with same length as str. Each list element i contains the split substrings from str[i]

Examples

## Not run: 
  str = "Hi\n\nyou!"
  str.split(str,"\n", keep.match=!TRUE)
  
  str <- c("aes_afe_f", "qwe.rty", "yui0op[3", "b")
  #split x on the letter e
  str  
  str.split(str, "e", keep.match=TRUE)
  str.split(str, "e", first=TRUE, keep.match=TRUE)
  
  str = c("aes_afe_fe")
  ignore.pos = cbind(1,3)
  str.split(str, "e", keep.match=TRUE, ignore.pos=ignore.pos)
  str.split(str, "e", first=TRUE,keep.match=TRUE, ignore.pos=ignore.pos)
  
  
  str = "abscde3823nsd34"
  str.split(str, "[a-z]*", fixed=FALSE, keep.match=TRUE)
  str.split(str, c("[a-z]*","d"), fixed=FALSE, keep.match=TRUE)
  
  str = c("abscde3823nsd34","8748274")
  str.split(str, c("[a-z]*","d"), fixed=FALSE, keep.match=TRUE)

## End(Not run)

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