clipString: Shortens strings to a given length

View source: R/clipString.R

clipStringR Documentation

Shortens strings to a given length

Description

Clips strings to a maximum length, appending a tail if shortened.

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))
print(clipString("abcdef", 5))

BBmisc documentation built on Nov. 6, 2026, 1:06 a.m.