Helper function taken from the biobase package. Duplicated here instead of loading the package to avoid overhead. See https://github.com/Bioconductor/Biobase
get_prefix(x, ignore.case = FALSE, trim = FALSE, delimiters = c(":", "\n"))
The longest common prefix of the strings.
Character vector.
Whether case matters (default).
Whether non alphabetic characters should be trimmed.
A list of prefix delimiters.
If any of the delimiters is present in the extracted prefix,
the part after is removed from the prefix.
Consider the following two items as an example:
c("Usage: in private context", "Usage: in work context")
.
The common prefix would be
"Usage: in "
, but it makes more sense to break it after the colon.