String#
String.base64Decode()#
Description: 将 base64 编码的字符串转换为纯文本
Syntax: String.base64Encode()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.base64Encode()#
Description: 将纯文本转换为 base64 编码的字符串
Syntax: String.base64Encode()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.concat()#
Description: 将一个或多个字符串连接到基础字符串的末尾。也可以使用 + 运算符(参见示例)。
Syntax: String.concat(string1, string2?, ..., stringN?)
Returns: String
Source: JavaScript function
Parameters:
string1(String) - 要追加的第一个字符串string2(String) - 可选 - 要追加的第二个字符串stringN(String) - 可选 - 要追加的第 N 个字符串
Examples:
1 2 | |
1 | |
String.extractDomain()#
Description: 如果字符串是电子邮件地址或 URL,则返回其域名(如果未找到则返回 undefined)。
如果字符串还包含其他内容,请先尝试使用 extractEmail() 或 extractUrl()。
Syntax: String.extractDomain()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
1 | |
1 | |
String.extractEmail()#
Description: 提取字符串中找到的第一个电子邮件地址。如果未找到则返回 undefined。
Syntax: String.extractEmail()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.extractUrl()#
Description: 提取字符串中找到的第一个 URL。如果未找到则返回 undefined。仅识别完整的 URL,例如以 http 开头的 URL。
Syntax: String.extractUrl()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.extractUrlPath()#
Description: 返回 URL 中域名之后的部分,如果未找到 URL 则返回 undefined。
如果字符串还包含其他内容,请先尝试使用 extractUrl()。
Syntax: String.extractUrlPath()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
1 | |
String.hash()#
Description: 使用指定的算法返回字符串的哈希值。未指定时默认使用 md5。
Syntax: String.hash(algo?)
Returns: String
Source: Custom n8n functionality
Parameters:
algo(String) - 可选 - 要使用的哈希算法。可选值:md5、base64、sha1、sha224、sha256、sha384、sha512、sha3、ripemd160
Examples:
1 | |
String.includes()#
Description: 如果字符串包含 searchString,则返回 true。区分大小写。
Syntax: String.includes(searchString, start?)
Returns: Boolean
Source: JavaScript function
Parameters:
searchString(String) - 要搜索的文本start(Number) - 可选 - 开始搜索的位置(索引)
Examples:
1 2 | |
1 2 3 | |
String.indexOf()#
Description: 返回 searchString 在基础字符串中首次出现的索引(位置),如果未找到则返回 -1。区分大小写。
Syntax: String.indexOf(searchString, start?)
Returns: Number
Source: JavaScript function
Parameters:
searchString(String) - 要搜索的文本start(Number) - 可选 - 开始搜索的位置(索引)
Examples:
1 2 | |
1 2 3 | |
String.isDomain()#
Description: 如果字符串是域名,则返回 true
Syntax: String.isDomain()
Returns: Boolean
Source: Custom n8n functionality
Examples:
1 | |
1 | |
1 | |
String.isEmail()#
Description: 如果字符串是电子邮件地址,则返回 true
Syntax: String.isEmail()
Returns: Boolean
Source: Custom n8n functionality
Examples:
1 | |
1 | |
1 | |
String.isEmpty()#
Description: 如果字符串没有字符或为 null,则返回 true
Syntax: String.isEmpty()
Returns: Boolean
Source: Custom n8n functionality
Examples:
1 | |
1 | |
String.isNotEmpty()#
Description: 如果字符串至少有一个字符,则返回 true
Syntax: String.isNotEmpty()
Returns: Boolean
Source: Custom n8n functionality
Examples:
1 | |
1 | |
String.isNumeric()#
Description: 如果字符串表示一个数字,则返回 true
Syntax: String.isNumeric()
Returns: Boolean
Source: Custom n8n functionality
Examples:
1 | |
1 | |
1 | |
String.isUrl()#
Description: 如果字符串是有效的 URL,则返回 true
Syntax: String.isUrl()
Returns: Boolean
Source: Custom n8n functionality
Examples:
1 | |
1 | |
1 | |
String.length#
Description: 字符串中的字符数量
Syntax: String.length
Returns: Number
Source: JavaScript function
Examples:
1 | |
String.match()#
Description: 使用正则表达式匹配字符串。返回包含第一个匹配项的数组,如果正则表达式中设置了 g 标志则返回所有匹配项。如果没有找到匹配项则返回 null。
如需检查文本是否存在,请考虑使用 includes()。
Syntax: String.match(regexp)
Returns: Array
Source: JavaScript function
Parameters:
regexp(RegExp) - 包含要查找模式的正则表达式。如果设置了g标志,则会查找多个匹配项(参见示例)。
Examples:
1 2 | |
1 2 | |
1 2 | |
String.parseJson()#
Description: 返回字符串所表示的 JavaScript Object 或值,如果字符串不是有效的 JSON 则返回 undefined。不支持单引号 JSON。
Syntax: String.parseJson()
Returns: any
Source: Custom n8n functionality
Examples:
1 | |
1 | |
1 | |
String.quote()#
Description: 用引号包裹字符串,并转义字符串中已有的引号。在构建 JSON、SQL 等时非常有用。
Syntax: String.quote(mark?)
Returns: String
Source: Custom n8n functionality
Parameters:
mark(String) - 可选 - 要使用的引号类型
Examples:
1 | |
String.removeMarkdown()#
Description: 移除字符串中的所有 Markdown 格式。同时也会移除 HTML 标签。
Syntax: String.removeMarkdown()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.removeTags()#
Description: 移除字符串中的标签,如 HTML 或 XML 标签
Syntax: String.removeTags()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.replace()#
Description: 返回将第一个匹配的 pattern 替换为 replacement 后的字符串。
如需替换所有匹配项,请使用 replaceAll()。
Syntax: String.replace(pattern, replacement)
Returns: String
Source: JavaScript function
Parameters:
pattern(String|RegExp) - 字符串中要替换的模式。可以是要匹配的字符串或正则表达式。replacement(String) - 用于替换的新文本
Examples:
1 | |
1 2 3 | |
1 2 3 4 5 | |
String.replaceAll()#
Description: 返回将所有匹配的 pattern 替换为 replacement 后的字符串
Syntax: String.replaceAll(pattern, replacement)
Returns: String
Source: JavaScript function
Parameters:
pattern(String|RegExp) - 字符串中要替换的模式。可以是要匹配的字符串或正则表达式。replacement(String|function) - 用于替换的新文本。可以是字符串或返回字符串的函数(参见示例)。
Examples:
1 | |
1 2 3 4 5 6 7 8 | |
String.replaceSpecialChars()#
Description: 将字符串中的特殊字符替换为最接近的 ASCII 字符
Syntax: String.replaceSpecialChars()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.search()#
Description: 返回字符串中第一个匹配模式的索引(位置),如果未找到则返回 -1。模式使用正则表达式指定。如需使用文本搜索,请参见 indexOf()。
Syntax: String.search(regexp)
Returns: Number
Source: JavaScript function
Parameters:
regexp(RegExp) - 包含要查找模式的正则表达式
Examples:
1 2 | |
1 2 3 | |
String.slice()#
Description: 在指定位置提取字符串的片段。如需更高级的提取,请参见 match()。
Syntax: String.slice(start, end?)
Returns: String
Source: JavaScript function
Parameters:
start(Number) - 开始位置。位置从 0 开始。负数表示从字符串末尾倒数。end(String) - 可选 - 截取到的位置。该位置的字符不包含在内。负数表示从字符串末尾选取。省略时将提取到字符串末尾。
Examples:
1 | |
1 | |
1 | |
String.split()#
Description: 将字符串拆分为子字符串数组。每次拆分在 separator 处进行,且分隔符不包含在输出中。
与对数组使用 join() 相反。
Syntax: String.split(separator?, limit?)
Returns: Array
Source: JavaScript function
Parameters:
separator(String) - 可选 - 用于拆分的字符串(或正则表达式)。省略时返回包含原始字符串的数组。limit(Number) - 可选 - 返回的最大数组元素数。省略时返回所有元素。
Examples:
1 | |
1 | |
1 2 | |
String.startsWith()#
Description: 如果字符串以 searchString 开头,则返回 true。区分大小写。
Syntax: String.startsWith(searchString, start?)
Returns: Boolean
Source: JavaScript function
Parameters:
searchString(String) - 用于检查基础字符串开头的文本start(Number) - 可选 - 开始搜索的位置(索引)
Examples:
1 2 | |
1 2 | |
String.substring()#
Description: 在指定位置提取字符串的片段。如需更高级的提取,请参见 match()。
Syntax: String.substring(start, end?)
Returns: String
Source: JavaScript function
Parameters:
start(Number) - 开始位置。位置从 0 开始。end(String) - 可选 - 截取到的位置。该位置的字符不包含在内。省略时将提取到字符串末尾。
Examples:
1 | |
1 | |
String.toBoolean()#
Description: 将字符串转换为布尔值。0、false 和 no 转换为 false,其他所有值转换为 true。不区分大小写。
Syntax: String.toBoolean()
Returns: Boolean
Source: Custom n8n functionality
Examples:
1 | |
1 | |
1 | |
1 | |
String.toDateTime()#
Description: 将字符串转换为 DateTime。可用于进一步的转换操作。字符串支持的格式包括 ISO 8601、HTTP、RFC2822、SQL 和毫秒级 Unix 时间戳。
如需解析其他格式,请使用 DateTime.fromFormat()。
Syntax: String.toDateTime()
Returns: DateTime
Source: Custom n8n functionality
Examples:
1 | |
1 | |
1 | |
1 | |
String.toJsonString()#
Description: 将字符串准备好以便插入 JSON 对象。转义引号和特殊字符(如换行符),并用引号包裹字符串。
与 JavaScript 的 JSON.stringify() 相同。
Syntax: String.toJsonString()
Returns: String
Source: Custom n8n functionality
Examples:
1 2 | |
String.toLowerCase()#
Description: 将字符串中的所有字母转换为小写
Syntax: String.toLowerCase()
Returns: String
Source: JavaScript function
Examples:
1 | |
String.toNumber()#
Description: 将表示数字的字符串转换为数字。如果字符串不是以有效数字开头,则抛出错误。
Syntax: String.toNumber()
Returns: Number
Source: Custom n8n functionality
Examples:
1 | |
1 | |
String.toSentenceCase()#
Description: 将字符串的大小写更改为句子格式。每个句子的首字母大写,其余字母小写。
Syntax: String.toSentenceCase()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.toSnakeCase()#
Description: 将字符串的格式更改为蛇形命名法。空格和破折号替换为 _,符号被移除,所有字母转为小写。
Syntax: String.toSnakeCase()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.toTitleCase()#
Description: 将字符串的大小写更改为标题格式。每个单词的首字母大写,其余字母保持不变。短介词和连词不大写(如 'a'、'the')。
Syntax: String.toTitleCase()
Returns: String
Source: Custom n8n functionality
Examples:
1 | |
String.toUpperCase()#
Description: 将字符串中的所有字母转换为大写
Syntax: String.toUpperCase()
Source: JavaScript function
Examples:
1 | |
String.trim()#
Description: 移除字符串两端的空白字符。空白字符包括换行符、制表符、空格等。
Syntax: String.trim()
Returns: String
Source: JavaScript function
Examples:
1 | |
String.urlDecode()#
Description: 解码 URL 编码的字符串。将 %XX 形式的字符编码替换为对应的字符。
Syntax: String.urlDecode(allChars?)
Returns: String
Source: Custom n8n functionality
Parameters:
allChars(Boolean) - 可选 - 是否解码属于 URI 语法的字符(例如=、?)
Examples:
1 | |
1 | |
String.urlEncode()#
Description: 对字符串进行编码使其可以在 URL 中使用。空格和特殊字符被替换为 %XX 形式的编码。
Syntax: String.urlEncode(allChars?)
Returns: String
Source: Custom n8n functionality
Parameters:
allChars(Boolean) - 可选 - 是否编码属于 URI 语法的字符(例如=、?)
Examples:
1 | |
1 | |