⬅️ 列表左侧补齐(补零、补空格右对齐)Left-Pad a List
把列表每一项在左侧补上字符,使所有项目长度相同:默认补到最长项目的长度,也可以指定宽度;补空格得到右对齐效果,补 0 得到 001、002 这样的固定位数编号(负号保持在最前面,如 -05),也可以用任意字符补齐;可按显示宽度计算中文(每个汉字算 2)。适合对齐数字、生成固定长度编号和排版文本,数据在本地处理。Pad every item in a list on the left so they all have the same length. By default items are padded to the longest one, or you can set the width. Pad with spaces to right-align, with zeros for fixed-width numbers like 001 and 002 (a minus sign stays in front, as in -05), or with any character. Width can be measured by display width, counting each Chinese character as two. Handy for aligning numbers, fixed-length IDs and text layout. Processed locally.
使用说明与常见问题How-to & FAQ
「列表左侧补齐(补零、补空格右对齐)」是什么?What is the Left-Pad a List tool?
把列表每一项在左侧补上字符,使所有项目长度相同:默认补到最长项目的长度,也可以指定宽度;补空格得到右对齐效果,补 0 得到 001、002 这样的固定位数编号(负号保持在最前面,如 -05),也可以用任意字符补齐;可按显示宽度计算中文(每个汉字算 2)。适合对齐数字、生成固定长度编号和排版文本,数据在本地处理。Pad every item in a list on the left so they all have the same length. By default items are padded to the longest one, or you can set the width. Pad with spaces to right-align, with zeros for fixed-width numbers like 001 and 002 (a minus sign stays in front, as in -05), or with any character. Width can be measured by display width, counting each Chinese character as two. Handy for aligning numbers, fixed-length IDs and text layout. Processed locally.
如何使用「列表左侧补齐(补零、补空格右对齐)」?How do I use the Left-Pad a List tool?
在「列表左侧补齐(补零、补空格右对齐)」中,把内容粘贴或输入到上方输入框,按需设置「输入分隔符」、「自定义」、「补齐字符」、「宽度(留空 = 最长项)」、「输出」,结果会实时显示在下方,点击「复制结果」即可复制。In the Left-Pad a List: Paste or type into the input box, adjust "Input separator", "Custom", "Pad character", "Width (blank = longest)", "Output"; the result appears below instantly — click "Copy result" to copy it.
补零时负数怎么处理?How are negative numbers zero-padded?
默认勾选“负号放在最前”,补 0 时会把 0 加在负号(或正号)之后,例如宽度 4 时 -5 变成 -005,与编程语言里格式化数字的结果一致;取消勾选则一律补在最左边(0-5)。只有补齐字符为 0 时才会这样处理。Keep the sign first is on by default, so zeros go after a minus (or plus) sign: at width 4, -5 becomes -005, as number formatting in programming languages does. Untick it to always pad on the far left (0-5). This only applies when the pad character is 0.
比宽度长的项目会被截断吗?Are items longer than the width cut off?
不会,超过宽度的项目保持原样,结果信息里会提示有几项超过了宽度。宽度留空时自动使用最长项目的长度,所以所有项目都会对齐。No. Items longer than the width stay as they are, and the status tells you how many there were. Leave Width blank to use the longest item's length so everything lines up.
中文为什么要按 2 个宽度算?Why count Chinese as double width?
在等宽字体里,一个汉字占两个英文字母的宽度。勾选后按显示宽度补齐,中英文混排的列表右对齐时才会整齐;用于生成固定字符数的编号时请不要勾选。In a monospace font, a Chinese character takes the width of two Latin letters. Tick it to pad by display width so mixed Chinese and English lines right-align neatly; leave it off when you need a fixed number of characters, such as for IDs.
输入和输出是什么样的?What does the input and output look like?
例如在「列表左侧补齐(补零、补空格右对齐)」中输入 1 ⏎ 22 ⏎ 333,输出为:001 ⏎ 022 ⏎ 333(⏎ 表示换行)。For example, the Left-Pad a List turns the input 1 ⏎ 22 ⏎ 333 into: 001 ⏎ 022 ⏎ 333 (⏎ marks a line break).
有哪些选项可以调整?What options can I adjust?
「列表左侧补齐(补零、补空格右对齐)」的设置:「输入分隔符」可选 自动识别、换行、逗号、分号、Tab、空格等(默认 自动识别);「自定义」可留空;「补齐字符」默认 0;「宽度(留空 = 最长项)」可留空;「输出」可选 每行一项、与输入相同(默认 每行一项);可勾选:「补零时负号放在最前(-05)」(默认勾选)、「中文按 2 个宽度计算」、「去掉首尾空格」(默认勾选)。改动任一选项后结果会按新设置重新生成。Settings in the Left-Pad a List — "Input separator": Auto-detect, New line, Comma, Semicolon, Tab, Space, etc. (default Auto-detect); "Custom" optional; "Pad character" default 0; "Width (blank = longest)" optional; "Output": One per line, Same as input (default One per line); tick boxes: "Keep the sign first when zero-padding (-05)" (on by default), "Count Chinese as double width", "Trim spaces" (on by default). Changing any option regenerates the result with the new setting.
处理大段文本会卡吗?Can it handle long text?
「列表左侧补齐(补零、补空格右对齐)」在浏览器中直接处理,几 MB 以内的文本通常瞬间完成;文本不会离开你的设备。The Left-Pad a List runs in your browser; text up to a few MB is usually processed instantly and never leaves your device.
「列表左侧补齐(补零、补空格右对齐)」免费吗?需要注册吗?Is the Left-Pad a List free? Do I need an account?
「列表左侧补齐(补零、补空格右对齐)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Left-Pad a List is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.