🔍

首页Home › 文本工具Text Tools

⇥ 空格转制表符Convert Spaces to Tabs

把空格换成 Tab:默认「固定连续空格」只转换行首空格;「制表位对齐(智能)」像 unexpand -a 一样,把整行中到达制表位的空格串都换成 Tab。本地处理。Turn spaces into tabs. The default "fixed run" mode converts only the leading spaces on each line; "tab stops (smart)" works like unexpand -a and converts every run of spaces that reaches a tab stop anywhere in the line. Processed locally.

使用说明与常见问题How-to & FAQ

「空格转制表符」是什么?What is the Convert Spaces to Tabs tool?

把空格换成 Tab:默认「固定连续空格」只转换行首空格;「制表位对齐(智能)」像 unexpand -a 一样,把整行中到达制表位的空格串都换成 Tab。本地处理。Turn spaces into tabs. The default "fixed run" mode converts only the leading spaces on each line; "tab stops (smart)" works like unexpand -a and converts every run of spaces that reaches a tab stop anywhere in the line. Processed locally.

如何使用「空格转制表符」?How do I use the Convert Spaces to Tabs tool?

在「空格转制表符」中,把内容粘贴或输入到上方输入框,按需设置「空格/Tab」、「模式」,结果会实时显示在下方,点击「复制结果」即可复制。In the Convert Spaces to Tabs: Paste or type into the input box, adjust "Spaces per tab", "Mode"; the result appears below instantly — click "Copy result" to copy it.

默认怎么转换?What does the default do?

默认是「固定连续空格(行首)」:只转换每行开头连续的空格,每满「空格/Tab」个换成一个 Tab,余下不足一个 Tab 的空格保留在 Tab 后面(例如宽度 4 时 6 个空格 → 1 个 Tab + 2 个空格);行内空格不动。The default is "Fixed run (leading)": only the run of spaces at the start of each line is converted — every full "Spaces per tab" becomes one tab and any leftover spaces stay after the tabs (with width 4, six spaces → one tab + two spaces). Spaces inside the line are left alone.

「制表位对齐(智能)」是什么?What is "Tab stops (smart)"?

按制表位(每「空格/Tab」列一个)处理整行,和 unexpand -a 相同:一串空格只要到达下一个制表位就换成 Tab,所以对齐的列在任意 Tab 宽度设置下仍然对齐;正好落在制表位前的单个空格(后面不再跟空白时)保留为空格,已有的 Tab 不变。It works on the whole line using tab stops every "Spaces per tab" columns, like unexpand -a: a run of spaces that reaches the next tab stop becomes a tab, so aligned columns stay aligned. A lone single space just before a tab stop stays a space, and existing tabs are kept.

换行符会变吗?Are line endings changed?

会统一成 LF(\n)。They are normalised to LF (\n).

输入和输出是什么样的?What does the input and output look like?

例如在「空格转制表符」中输入 hi,「空格/Tab」设为 4,输出为:⇥ hi(⇥ 表示制表符)。For example, the Convert Spaces to Tabs turns the input hi, "Spaces per tab" set to 4 into: ⇥ hi (⇥ marks a tab).

有哪些选项可以调整?What options can I adjust?

「空格转制表符」的设置:「空格/Tab」默认 4;「模式」可选 固定连续空格(行首)/、制表位对齐(智能)/(默认 固定连续空格(行首)/)。每次生成结果都按当前设置处理。Settings in the Convert Spaces to Tabs — "Spaces per tab" default 4; "Mode": Fixed run (leading), Tab stops (smart) (default Fixed run (leading)). The result always uses the current settings.

处理大段文本会卡吗?Can it handle long text?

「空格转制表符」在浏览器中直接处理,几 MB 以内的文本通常瞬间完成;文本不会离开你的设备。The Convert Spaces to Tabs runs in your browser; text up to a few MB is usually processed instantly and never leaves your device.

「空格转制表符」免费吗?需要注册吗?Is the Convert Spaces to Tabs free? Do I need an account?

「空格转制表符」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Convert Spaces to Tabs is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.

相关工具Related tools

🔃 旋转文本行Rotate Text🔡 大写转小写Uppercase to Lowercase📄 文本摘要(抽取式)Text Summarizer (Extractive)📚 引用生成器Citation Generator✉️ 求职信生成器Cover Letter Generator段落生成器Paragraph Generator🔢 编辑器字数统计Editor Counter🔢 字数统计Word & Character Counter🔠 大小写转换Case Converter🧹 删除重复行Remove Duplicate Lines↕️ 文本行排序Sort Lines🆚 文本对比Text Diff Checker

← 全部工具All tools