Skip to content

Shortens text to a maximum width (character length). If the text is longer, it is truncated and an ellipsis (default "...") is appended.

Usage

whapi_clip_text(x, width = 420, ellipsis = "...")

Arguments

x

Character string to clip.

width

Maximum length of the output including ellipsis.

ellipsis

Character to indicate truncation.

Value

A clipped string with ellipsis if needed.

Examples

whapi_clip_text("This is a very long sentence that should be clipped.", width = 20)
#> [1] "This is a very lo..."
#> "This is a very long..."