✂️ 截断 Unicode 文本Truncate Unicode
按字素截断到最大长度,可选省略号(省略号计入长度)。本地处理。可设置「最大字素数」、「省略号」。Truncate to a maximum number of graphemes with an optional ellipsis, which counts toward the limit. Processed locally. Settings: Max graphemes, Ellipsis.
使用说明与常见问题How-to & FAQ
「截断 Unicode 文本」是什么?What is the Truncate Unicode tool?
按字素截断到最大长度,可选省略号(省略号计入长度)。本地处理。可设置「最大字素数」、「省略号」。Truncate to a maximum number of graphemes with an optional ellipsis, which counts toward the limit. Processed locally. Settings: Max graphemes, Ellipsis.
如何使用「截断 Unicode 文本」?How do I use the Truncate Unicode tool?
在「截断 Unicode 文本」中,把内容粘贴或输入到上方输入框,按需设置「最大字素数」、「省略号」,结果会实时显示在下方,点击「复制结果」即可复制。In the Truncate Unicode: Paste or type into the input box, adjust "Max graphemes", "Ellipsis"; the result appears below instantly — click "Copy result" to copy it.
省略号算在长度里吗?Does the ellipsis count toward the length?
算。例如 hello world、最大 5、省略号为 … 时结果是 hell…(共 5 个字素);把省略号框清空则结果是 hello。不超过最大长度的文本原样保留,不加省略号。结果永远不会超过最大字素数:省略号不短于最大长度时只输出省略号的前几个字素(最大 3、省略号 .... 得到 ...;最大 0 得到空结果)。Yes. For example hello world with Max 5 and the ellipsis … gives hell…, five graphemes in total; with the Ellipsis box cleared it gives hello. Text that already fits is returned unchanged, with no ellipsis. The result never exceeds Max graphemes: when the ellipsis is at least as long as the maximum, only its first graphemes are output (Max 3 with the ellipsis .... gives ...; Max 0 gives an empty result).
什么是字素(字素簇)?What is a grapheme (grapheme cluster)?
字素(字素簇)就是看到的一个字符,它可能由好几个码位组成:例如 é 可以是 e 加一个组合重音符,👨👩👧 是用零宽连接符连起来的 5 个码位,🇹🇼 是两个区域指示符。本页按 Unicode 规则(UAX #29,即浏览器的 Intl.Segmenter)切分字素,所以这些都算 1 个,不会被拆开。A grapheme (grapheme cluster) is one user-perceived character, which can be made of several code points: é can be e plus a combining accent, 👨👩👧 is five code points joined by zero-width joiners, and 🇹🇼 is two regional indicators. This page splits graphemes with the Unicode rules (UAX #29, the browser's Intl.Segmenter), so each of these counts as 1 and is never broken apart.
输入和输出是什么样的?What does the input and output look like?
例如在「截断 Unicode 文本」中输入 hello world,「最大字素数」设为 5,输出为:hell…。For example, the Truncate Unicode turns the input hello world, "Max graphemes" set to 5 into: hell….
有哪些选项可以调整?What options can I adjust?
「截断 Unicode 文本」的设置:「最大字素数」默认 10;「省略号」默认 …。每次生成结果都按当前设置处理。Settings in the Truncate Unicode — "Max graphemes" default 10; "Ellipsis" default …. The result always uses the current settings.
处理大段文本会卡吗?Can it handle long text?
「截断 Unicode 文本」在浏览器中直接处理,几 MB 以内的文本通常瞬间完成;文本不会离开你的设备。The Truncate Unicode runs in your browser; text up to a few MB is usually processed instantly and never leaves your device.
「截断 Unicode 文本」免费吗?需要注册吗?Is the Truncate Unicode free? Do I need an account?
「截断 Unicode 文本」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Truncate Unicode is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.