clipString {BBmisc}R Documentation

Shortens strings to a given length.

Description

Shortens strings to a given length.

Usage

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

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 “...”.

Value

[character(1)].

Examples

print(clipString("abcdef", 10))
## [1] "abcdef"
print(clipString("abcdef", 5))
## [1] "ab..."

[Package BBmisc version 1.7 Index]