longestCommonPrefix {PTXQC}R Documentation

Get the longest common prefix from a set of strings.

Description

Input is converted to character (e.g. from factor) first.

Usage

longestCommonPrefix(strings)

Arguments

strings

Vector of strings

Value

Single string - might be empty ("")

Examples

  longestCommonPrefix(c("CBA.321", "CBA.77654", ""))    ## ""
  longestCommonPrefix(c("CBA.321", "CBA.77654", "CB"))  ## "CB"
  longestCommonPrefix(c("ABC.123", "ABC.456"))          ## "ABC."
  longestCommonPrefix(c("nothing", "in", "common"))     ## ""



[Package PTXQC version 1.1.1 Index]