sen2r (version 1.2.1)

comsub: Find the longest common starting substring or directory

Description

The function search for the longest common prefix between multiple strings.

Usage

comsub(data, sep = "")

Arguments

data

A vector of strings

sep

A character which is used to separate elements; default ("") is used to compare single characters; other useful alternatives are "/" (or "\\" in Windows) to find the longest common directory, or " " to compare words instead of characters.

Value

A character with the longest common initial substring

Examples

Run this code
# NOT RUN {
strings <- c("/home/user/git/sen2r",
             "/home/user/git_data/sen2r/ex/vrt/01_translate/")

comsub(strings)

comsub(strings, sep="/")
# }

Run the code above in your browser using DataLab