You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
expression function
String handler
Copy page
Download PDF
String handler
This document describes the syntax and format of string handlers, related scenario examples, and more. ​
str_join function ​
String join function. This function uses a separator to join multiple strings. ​
Function syntax/format ​
​
str_join(separator,value1,value2...)​
​
Parameters are described as follows: ​
​
Parameter​
Parameter type​
Is it required?​
Default value​
Value range​
Description​
Separator​
String​
Yes​
/​
/​
Separator. For example, underscore (_), pound sign (#), asterisk (*), hyphen (-), etc.​
Value​
String​
Yes​
/​
/​
The value to be connected.​
​
Function example ​
  • scenario: Splice email addresses according to employee names and companies. ​
  • Processing rule: ​
  • ​
    f_set("join",str_join("@",v("name"),v("company")))​
    ​
  • Log sample: ​
  • ​
    {​
    "name":"zhangsan",​
    "company":"volcengine.com"​
    }​
    ​
  • Processing result: ​
  • ​
    {​
    "name":"zhangsan",​
    "company":"volcengine.com",​
    "join":"zhangsan@volcengine.com"​
    }​
    ​
str_len function ​
Calculates string length. ​
Function syntax/format ​
​
str_len(value)​
​
Parameters are described as follows: ​
​
Parameter​
Parameter type​
Is it required?​
Default value​
Value range​
Description​
Value​
String​
Yes​
/​
/​
The field value of the length to be calculated.​
​
Function example ​
  • Scenario: Get the string length of the field company . ​
  • Processing rules: ​
  • ​
    f_set("len",str_len(v("company"))​
    ​
  • Log example: ​
  • ​
    {​
    "company": "volcengine",​
    "product": "tls"​
    }​
    ​
  • Processing result: ​
  • ​
    {​
    "company": "volcengine",​
    "product": "tls",​
    "len": 9​
    }​
    ​
str_replace function ​
Replaces the substring in the string multiple times. ​
function syntax/format ​
​
str_replace(value,old,new,count)​
​
Parameter description is as follows: ​
​
Parameter​
Parameter type​
Is it required?​
Default value​
Value range​
Description​
Value​
String​
Yes​
/​
/​
The original string.​
Old​
String​
Yes​
/​
/​
Replace the previous string.​
New​
String​
Yes​
/​
/​
After replacing string.​
Count​
Number​
No​
/​
Count > 0​
Number of replacements, default all replacements when not set.​
​
Function example ​
  • Scenario: Replace Shanghai with Shanghainew. ​
  • Processing rules: ​
  • ​
    f_set("replace",str_replace(v("region"),"Shanghai","Shanghainew")​
    ​
  • Log sample: ​
  • ​
    {​
    "region": "Shanghai"​
    }​
    ​
  • Processing result: ​
  • ​
    {​
    "region": "Shanghai",​
    "replace": "Shanghainew"​
    }​
    ​
str_format function ​
String formatting. ​
Function syntax/format ​
​
str_format(format,value1,value2...)​
​
Parameter description is as follows: ​
​
Parameter​
Parameter type​
Is it required?​
Default value​
Value range​
Description​
Separator​
String​
Yes​
/​
/​
To format the string, replace the parameter with {}.​
Value​
String​
Yes​
/​
/​
Value to be formatted, variable parameter.​
​
Function example ​
  • Scenario: according to the province, city and county streets, splicing out the detailed address. ​
  • Processing rules: ​
  • ​
    f_set("Address",str_format("address:{}{}{}",v("province"),v("city"),v("town"),v("detail")))​
    ​
  • Log example: ​
  • ​
    {​
    "province": "Sichuan province",​
    "city": "Chengdu city",​
    "town": "Wuhou"​
    }​
    ​
  • Processing results: ​
  • ​
    {​
    "province": "Sichuan province",​
    "city": "Chengdu city",​
    "town": "Wuhou",​
    "address": "Address:231 Hao, Wuhouci street, Wuhou town, Chengdu city, Sichuan province"​
    }​
    ​
​
​
Last updated: 2026.07.01 16:52:15