For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /nodes/09/StringCompare.md.

比较(StringCompare)

StringComparetext角色:逻辑

StringCompare节点使用不同的比较方法来比较两个文本字符串。它可以检查一个字符串是否以另一个字符串开头、结尾,或者两个字符串是否完全相等。比较时可以区分或忽略字母大小写。

参数

参数类型默认 / 范围说明
string_aSTRING多行文本文本输入。
string_bSTRING多行文本文本输入。
modeCOMBOStarts With、Ends With、Equal—
case_sensitiveBOOLEAN · 布尔true / false—

输出

输出类型说明
BOOLEANBOOLEAN布尔

怎么接

  • 上游:ComfySwitchNode / 比较结果
  • 下游:ComfyAndNode / 开关类节点的布尔口
  • 接线:输出布尔值,接到开关类节点或 ComfySwitchNode 的条件口,用来做分支与开关。

使用案例

从 string_a(多行文本)、string_b(多行文本)、mode(Starts With、Ends With、Equal) 开始填就能跑起来。典型接法:ComfySwitchNode → 本节点 → ComfyAndNode。输出类型是 BOOLEAN,只能接同类型的输入端口,颜色对不上就是接错了。

端口与连线示意

StringCompare 端口与连线示意

同类节点

保存文本 · 文本前添加 · 文本后添加 · 构建 JSON 提示(Ideogram) · 大小写转换器 · 数组转字符串 · 字典转字符串 · 从JSON提取字符串 · 融合文本序列 · 正则表达式提取 · 正则表达式匹配 · 正则表达式替换