BBmisc (version 1.13)

clipString: Shortens strings to a given length.

Description

Shortens strings to a given length.

Usage

clipString(x, len, tail = "...")

Value

[character(1)].

Arguments

x

[character]
Vector of strings.

len

[integer(1)]
Absolute length the string should be clipped to, including tail. Note that you cannot clip to a shorter length than tail.

tail

[character(1)]
If the string has to be shortened at least 1 character, the final characters will be tail. Default is “...”.

Examples

Run this code
print(clipString("abcdef", 10))
print(clipString("abcdef", 5))

Run the code above in your browser using DataLab