UNPKG

@stdlib/string

Version:

String manipulation functions.

49 lines (37 loc) 1.35 kB
{{alias}}( str[, n][, options] ) Removes the first character(s) of a `string`. Parameters ---------- str: string Input string. n: integer (optional) Number of characters to remove. Default: 1. options: Object (optional) Options. options.mode: string (optional) Type of characters to return. The following modes are supported: - grapheme: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - code_point: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - code_unit': UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). Default: 'grapheme'. Returns ------- out: string Updated string. Examples -------- > var out = {{alias}}( 'beep' ) 'eep' > out = {{alias}}( 'Boop' ) 'oop' > out = {{alias}}( 'foo bar', 4 ) 'bar' See Also --------