Identify shared leading or trailing character strings
Identify shared leading or trailing character strings
Compares all elements of a vector of numbers or character strings and returns TRUE if they are all the same, FALSE otherwise.
identify_common_string(strings, leading =TRUE)
Arguments
strings: vector of strings to be evaluated.
leading: boolean variable indicating whether the function should look for common strings at the beginning (leading==TRUE) or end (leading==FALSE) of the strings. Default is TRUE.
Returns
if there is a leading (if leading==TRUE) or trailing (if leading==FALSE) string that all elements of strings have in common, this string is returned; NA otherwise.