高级文本拆分器

拆分分隔符选项

用于将文本分成若干部分的字符。(默认空格)

用于分割文本的正则表达式。(默认按多个空格)

每个输出块中的符号数量。

输出中相等长度块的数量。

输出分隔符选项

拆分块之间的字符。(默认换行)

附加选项

如何使用高级文本分割器

  1. 粘贴你的文本
    • 将您想要分隔的文本粘贴或写入工具顶部的大文本字段中。对于较长的文本,您也可以通过工具栏中的“选择文件”选项导入 .txt 文件。
    • 要进行测试,请使用“示例”按钮加载示例文本。这可以帮助你在使用自己的内容之前了解不同分割方法的功能。
  2. 设置拆分方法
    • 使用符号分割: 选择此项可以在每个特定字符(例如逗号、空格或分号)出现时拆分文本。默认是空格,它会将文本拆分为单词。
    • 按正则表达式拆分: 使用正则表达式进行复杂的拆分规则。默认 [^\a-zA-Z]+ 是在任意非字母字符序列上的一次分割。即使单词中混有标点符号,它也会进行分割。
    • 长度分割: 这种方法将你的文本分成固定字符数的块。输入你想生成的数字(例如,100)以获得相等的部分,非常适合字符受限的社交媒体帖子或短信消息。
    • 按块数拆分: 选择文本应被分成的等分段数。然后该工具会根据此自动计算每个块应有的长度。
  3. 自定义输出和附加选项
    • 设置 输出分隔符 控制分割后的片段在结果框中如何连接。换行符(\n) 将每个部分放在自己的行上。管道(|) 或逗号可以用分隔符制作一行列表。
    • 使用 块前字符块后的字符 字段可以为每个分割的部分添加前缀或后缀,例如引号或括号。
    • 探索 额外选项“保留分隔符”会在结果中保留分隔字符,“为每部分编号”会为每个分割段添加顺序编号,“忽略空部分”会移除空条目,“删除每行的空格”会移除每行的首尾空格。
  4. 运行并导出
    • 点击 拆分文本 将你的输入分开。结果将立即显示在下方的文本区域。
    • 点击 复制结果 将输出复制到剪贴板或 下载 将其下载为 txt 文件。该 “全部清除” 按钮重置整个工具,准备进行新的任务。

实际示例和使用案例

示例 1:处理逗号分隔列表(CSV 数据)

Let’s say you have some survey data or a basic CSV file that is not properly formatted. You want to put the individual things into a nice vertical list for study, or to import into another application.

apple, banana, cherry, date, elderberry, fig

配置: Choose 按符号拆分 and type a comma (,) into the symbol box. Set the 输出分隔符 to newline (\n). Get clean results by selecting 修剪空格 and 跳过空部分.

This method is great for data cleansing, building lists for databases or preparing tags for a website CMS from one string of text.

输出: All stray spaces removed, and every fruit is on its own line. The output is an organized list, ready to be used further.

apple
banana
cherry
date
elderberry
fig

示例 2:为短信或社交媒体帖子格式化文本

If you’re using a platform like Twitter (X) or SMS, there are quite severe character constraints. If you have a long message, you need to break it up into compliant portions and keep it readable.

Thank you for being part of the yearly tech conference. The talk on AI ethics was especially informative, stressing the importance of transparent algorithms. We are looking forward to seeing you at the workshop tomorrow.

配置: Select 按长度拆分 and set 160 (a common SMS limit). The program will break the text into parts of exactly 160 characters. You may also add things like "(1/3)" to each bit with the "Char Before/After Chunk".

输出: The text is now split into chunks within the character limit. This ensures that your complete message is sent and not cut off by the platform.

Thank you for being part of the yearly tech conference. The talk on AI ethics was especially informative, stressing the importance of transparent algorithms. We are looking forward to seeing you at the workshop tomorrow.