Learn R Programming

PTXQC (version 1.0.4)

longestCommonSuffix: Like longestCommonPrefix(), but on the suffix.

Description

Like longestCommonPrefix(), but on the suffix.

Usage

longestCommonSuffix(strings)

Arguments

strings

Vector of strings

Value

Single string - might be empty ("")

Examples

Run this code
# NOT RUN {
 longestCommonSuffix(c("123.ABC", "45677.ABC", "BC"))  ## "BC"
 longestCommonSuffix(c("123.ABC", "", "BC"))           ## ""
 longestCommonSuffix(c("123.ABC", "45677.ABC"))        ## ".ABC"
 longestCommonSuffix(c("nothing", "in", "common"))     ## ""
 
# }

Run the code above in your browser using DataLab