Learn R Programming

whapi (version 0.0.2)

whapi_clip_text: Clip long text with ellipsis

Description

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 = "...")

Value

A clipped string with ellipsis if needed.

Arguments

x

Character string to clip.

width

Maximum length of the output including ellipsis.

ellipsis

Character to indicate truncation.

Examples

Run this code
whapi_clip_text("This is a very long sentence that should be clipped.", width = 20)
#> "This is a very long..."

Run the code above in your browser using DataLab