✂️ 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
⚠️ 使用說明與注意事項