Diysb Tools

列表分组

将列表分割成固定大小的连续块。此工具分离输入项,按顺序将它们分块,可选择填充不完整的块,并使用自定义分隔符和包装器格式化输出。

列表工具
输入列表
分组结果
工具选项
输入项分隔符
使用符号拆分
使用单个字符分隔输入项。
使用正则表达式拆分
使用正则表达式分隔输入项。
用于分隔输入项的分隔符或正则表达式。
组大小和输出格式
每组的项目数
组内项目之间的分隔符
组之间的分隔符
每组前添加的符号
每组后添加的符号
空项处理和填充
忽略空项目并从结果中排除它们。
如果最后一组项目数量不足,则填充它。
用于填充不完整组的字符或值。
列表分组 示例

Group Hexagon Coordinates

In this example, we group the coordinates of a regular hexagon. The input coordinates are given as a space-separated list "x1 y1 x2 y2 x3 y3 …". What we want to do is create vector point pairs such as "(x1, y1); (x2, y2); (x3, y3); …". To do that, we use the space character as the input coordinate separator, and to create vectors, we group them by pairs. We wrap the coordinates in parentheses, put a comma between the x and y group items, and a semicolon between individual groups.

2.5 9.33 0 5 2.5 0.66 7.5 0.66 10 5 7.5 9.33
2.5 9.33 0 5 2.5 0.66 7.5 0.66 10 5 7.5 9.33
(2.5, 9.33); (0, 5); (2.5, 0.66); (7.5, 0.66); (10, 5); (7.5, 9.33)
(2.5, 9.33); (0, 5); (2.5, 0.66); (7.5, 0.66); (10, 5); (7.5, 9.33)
输入项分隔符
使用符号拆分
使用单个字符分隔输入项。
使用正则表达式拆分
使用正则表达式分隔输入项。
用于分隔输入项的分隔符或正则表达式。
组大小和输出格式
每组的项目数
组内项目之间的分隔符
组之间的分隔符
每组前添加的符号
每组后添加的符号
空项处理和填充
忽略空项目并从结果中排除它们。
如果最后一组项目数量不足,则填充它。
用于填充不完整组的字符或值。

Chunks of Size 3

This example demonstrates grouping of list items and creates 9 groups of 3 items. The input list contains all alphabet letters (26 letters, separated by a semicolon) and the output is groups of letter trigrams. As the last group is missing one letter, we enable padding and add the underscore symbol as the padding element.

a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z
a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z
[a, b, c] [d, e, f] [g, h, i] [j, k, l] [m, n, o] [p, q, r] [s, t, u] [v, w, x] [y, z, _]
[a, b, c] [d, e, f] [g, h, i] [j, k, l] [m, n, o] [p, q, r] [s, t, u] [v, w, x] [y, z, _]
输入项分隔符
使用符号拆分
使用单个字符分隔输入项。
使用正则表达式拆分
使用正则表达式分隔输入项。
用于分隔输入项的分隔符或正则表达式。
组大小和输出格式
每组的项目数
组内项目之间的分隔符
组之间的分隔符
每组前添加的符号
每组后添加的符号
空项处理和填充
忽略空项目并从结果中排除它们。
如果最后一组项目数量不足,则填充它。
用于填充不完整组的字符或值。

Convert a List to a TSV

In this example, we use our list item grouper to convert a food list to tab-separated values (TSV). As spaces are chaotically used between the items of the input list, we use the item separating regular expression "\s+" to match them. We create a TSV with three columns (three groups), separate them with a tab character, and put newlines between the groups.

beef buns cake corn crab dill fish kiwi kale lime meat mint milk pear plum pate pork rice soup tuna tart
beef buns cake corn crab dill fish kiwi kale lime meat mint milk pear plum pate pork rice soup tuna tart
beef buns cake corn crab dill fish kiwi kale lime meat mint milk pear plum pate pork rice soup tuna tart
beef buns cake corn crab dill fish kiwi kale lime meat mint milk pear plum pate pork rice soup tuna tart
输入项分隔符
使用符号拆分
使用单个字符分隔输入项。
使用正则表达式拆分
使用正则表达式分隔输入项。
用于分隔输入项的分隔符或正则表达式。
组大小和输出格式
每组的项目数
组内项目之间的分隔符
组之间的分隔符
每组前添加的符号
每组后添加的符号
空项处理和填充
忽略空项目并从结果中排除它们。
如果最后一组项目数量不足,则填充它。
用于填充不完整组的字符或值。