Skip to contents

The result is such that all(startsWith(str,determinePrefix(str))) is TRUE.

Usage

determinePrefix(str, split = "-", collapse = "-")

Arguments

str

a character vector

split

the token to use for strsplit instead of '-', this should be character(0) if you want to split letter by letter

Value

the prefix common to all entries of str.

Details

By default, the strings are assumed to be '-' separated words, and a series of words is found to be thje prefix if all entries start with that set of words.

The normal case is c("abc-1","abc-2b","abc-2a") maps to "abc"