Learn R Programming

bsts (version 0.9.10)

shorten: Shorten long names

Description

Removes common prefixes and suffixes from character vectors.

Usage

Shorten(words)

Value

The argument words is returned, after common prefixes and suffixes have been removed. If all arguments are identical then no shortening is done.

Arguments

words

A character vector to be shortened.

Author

Steven L. Scott steve.the.bayesian@gmail.com

See Also

bsts.mixed.

Examples

Run this code
  Shorten(c("/usr/common/foo.tex", "/usr/common/barbarian.tex"))
  # returns c("foo", "barbarian")

  Shorten(c("hello", "hellobye"))
  # returns c("", "bye")

  Shorten(c("hello", "hello"))
  # returns c("hello", "hello")

  Shorten(c("", "x", "xx"))
  # returns c("", "x", "xx")

  Shorten("abcde")
  # returns "abcde"

Run the code above in your browser using DataLab