Learn R Programming

JATSdecoder (version 1.2.0)

strsplit2: strsplit2

Description

Extension of strsplit(). Makes it possible to split lines before or after a pattern match without removing the pattern.

Usage

strsplit2(x, split, type = "remove", perl = FALSE)

Value

A list of the same length as x, the i-th element of which contains the vector of splits of x[i].

Arguments

x

text string to process.

split

pattern to split text at.

type

one out of c("remove", "before", "after").

perl

Logical. If TRUE uses perl expressions.

Examples

Run this code
x<-"This is some text, where text is the split pattern of the text."
strsplit2(x,"text","after")

Run the code above in your browser using DataLab