/** * Counts the number of grapheme clusters (user-perceived characters) in a Unicode string. * * This function properly handles complex Unicode characters including: * - Emoji with skin tone modifiers (e.g., πŸ‘πŸ½) * - Multi-codepoint emoji sequences (e.g., family emoji πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦) * - Flag emoji (e.g., πŸ‡ΊπŸ‡Έ) * - Accented characters and combining marks * * @param str - The Unicode string to count. * @returns The number of grapheme clusters in the string. * * @example * lengthUnicode('hello') // => 5 * lengthUnicode('πŸ‘πŸ½πŸ‘') // => 2 (skin tone modifier counted as part of first emoji) * lengthUnicode('πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦') // => 1 (complex emoji sequence counted as single grapheme) */ export declare function lengthUnicode(str: string): number; /** * Extracts a section of a Unicode string by grapheme cluster indices. * * This function correctly slices strings containing complex Unicode characters where * multiple codepoints form a single user-perceived character. Use this instead of * {@link slice} for proper Unicode-aware slicing. * * @param str - The Unicode string to slice. * @param start - The starting grapheme cluster index (inclusive). Negative indices count from the end. * @param end - The ending grapheme cluster index (exclusive). Negative indices count from the end. Optional. * @returns A new string containing the extracted grapheme clusters. * * @example * unicodeSlice('hello', 1, 4) // => 'ell' * unicodeSlice('πŸ‘πŸ½πŸ‘πŸ˜€', 0, 2) // => 'πŸ‘πŸ½πŸ‘' (correctly handles skin tone modifier) * unicodeSlice('πŸ˜€πŸ˜πŸ˜‚', 1) // => 'πŸ˜πŸ˜‚' */ export declare function unicodeSlice(str: string, start: number, end?: number): string; /** * Reverses the order of grapheme clusters in a Unicode string. * * This function properly reverses strings containing complex Unicode characters where * multiple codepoints form a single user-perceived character. It maintains the integrity * of multi-codepoint emoji and other complex grapheme clusters. Use this instead of * {@link reverse} for Unicode-aware reversal. * * @param str - The Unicode string to reverse. * @returns A new string with grapheme clusters in reverse order. * * @example * reverseUnicode('hello') // => 'olleh' * reverseUnicode('πŸ‘πŸ½πŸ‘') // => 'πŸ‘πŸ‘πŸ½' (preserves emoji integrity) * reverseUnicode('πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦πŸ˜€') // => 'πŸ˜€πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦' (maintains complex emoji as single unit) */ export declare function reverseUnicode(str: string): string; //# sourceMappingURL=unicode.d.ts.map