Truncate a string by weighted length, counting non-ASCII characters as two units.
Usage:
import { cutZHString } from "mazey";const ret = cutZHString("hello world", 5);console.log(ret); Copy
import { cutZHString } from "mazey";const ret = cutZHString("hello world", 5);console.log(ret);
Output:
hello Copy
hello
String to truncate.
Maximum weighted length.
Optional
Text appended when truncation occurs.
Whether to append truncation text.
The truncated string.
Truncate a string by weighted length, counting non-ASCII characters as two units.
Usage:
Output: