✂️ Text Trimmer

📐 工作原理与说明
处理顺序固定:先删除所有制表符(\t → 空),再删除所有空格与制表符([ \t] → 空),再把连续空格折叠为一个([ ]+ → 空格);随后按行处理——每行去首尾空白、把连续空行折叠为一行、或直接删除全部空行,最后用 \n 拼回;最后再去开头空白(^\s+)与结尾空白(\s+$)。结果为空时显示「(无内容)」

Strip leading, trailing and in-line extra whitespace, compress consecutive blank lines and optionally remove full-width spaces after copying from web pages or spreadsheets.

修剪选项

📋 修剪结果

请输入文本...

📚 深度解析:去除空白

💡 常见使用场景

  • 表单输入清洗:去掉首尾空格,避免「alice 」登录失败或键不匹配。
  • 数据规整:去除行首尾空白与空行,准备入库或比对。
  • 复制粘贴净化:从网页复制常带隐藏空格/全角空格,统一清除。
清首尾空格
输入「 订单号 1001 」,trim 得「订单号 1001」;可同时去行内多余空格与空行,避免「1001 」被当不同键。

❓ 常见问题(FAQ)

全角空格去吗?
可选。普通 trim 只去半角空格与制表;全角空格(U+3000)需开启「含全角」才清,否则仍留在首尾。
会删行内空格吗?
默认只去首尾,保留词间空格;如需压缩为单空格请用「合并空白」选项,避免破坏正常排版。

Formula & Standard References

Item Formula / Note Source / Standard
Whitespace definition trimming targets whitespace property characters including breaks and tabs Unicode UAX #44, character database
Inner whitespace trimming affects only the ends while inner runs need separate collapsing ECMA-262, string trim
Zero width characters zero width spaces are not ordinary whitespace and may survive trimming Unicode UAX #15, normalisation forms
⚠️ 使用说明与注意事项