This topic describes the syntax rules of string functions, including parameter descriptions and function examples.

Functions

Type Function Description
Multi-string operation str_format Formats a string.
str_join Concatenates the elements in a sequence with a specified string to generate a new string.
str_zip Splits two value strings or expression strings concurrently and then merges them into a single string.
Sorting, reversing, and replacement str_sort Sorts specified objects.
str_reverse Reverses a string.
str_replace Replaces an old string with a new string according to the corresponding rule.
str_logstash_config_normalize Converts the data format of the Logstash configuration language into the JSON format.
str_translate Replaces the specified characters of a string with the corresponding characters.
Regular munging str_strip Deletes a specified character from a string.
str_lstrip Deletes a specified character from the start of a string.
str_rstrip Deletes a specified character from the end of a string.
str_lower Converts all uppercase characters in a string into lowercase characters.
str_upper Converts all lowercase characters in a string into uppercase characters.
str_title Capitalizes only the first letter of all words.
str_capitalize Capitalizes only the first letter of a string.
str_swapcase Interchanges uppercase letters and lowercase letters in a string.
Search and check str_count Counts the number of occurrences of a character in a string.
str_find Checks whether an original string contains a specified substring.
str_rfind Finds the position of the last occurrence of a character in a string.
str_endswith Checks whether a string ends with a specified suffix.
str_endswith Checks whether a string starts with a specified string.
Splitting str_split Splits a string with a specified delimiter.
str_splitlines Splits a string with a line break.
str_partition Splits a string with a specified delimiter into three parts from left-to-right.
str_rpartition Splits a string with a specified delimiter into three parts from right-to-left.
Formatting str_center Pads a string to a specified length with a specified character.
str_ljust Pads a string to a fixed length from the end with a specified character.
str_rjust Pads a string to a specified length from the start with a specified character.
str_zfill Pads a string to a specified length from the start with 0.
str_expandtabs Converts \t in a string into a space character.
Character set check str_isalnum Checks whether a string consists of only letters and digits.
str_isalpha Checks whether a string consists of only letters.
str_isascii Checks whether a string is in the ASCII table.
str_isdecimal Checks whether a string contains only decimal characters.
str_isdigit Checks whether a string consists of only digits.
str_isidentifier Checks whether a string is a valid Python identifier, and whether a variable name is valid.
str_islower Checks whether a string consists of lowercase letters.
str_isnumeric Checks whether a string consists of digits.
str_isprintable Checks whether all characters in a string are printable characters.
str_isspace Checks whether a string consists of only whitespace characters.
str_istitle Checks whether the first letter of all words in a string is in uppercase and whether other letters in the string are in lowercase.
str_isupper Checks whether all letters in a string are uppercase letters.
The following table describes the functions that can be used together with string functions.
Type Function Description
Multi-string operation op_add Performs a logic AND operation of multiple numeric values. This function can be used for numeric values and strings.
op_max Calculates the maximum value among multiple values. This function can be used for numeric values and strings.
op_min Calculates the minimum value among multiple values. This function can be used for numeric values and strings.
String truncation op_slice Truncates a string.
Length calculation op_len Calculates the length of a string.

str_format

  • Function format
    str_format(formatted string,value 1,value 2,...)
  • Function parameters
    Parameter Type Required Description
    formatted string Arbitrary type (automatically converted to a string) Yes The format of the converted string, for example, {}={}
    value 1 Arbitrary type Yes Value 1 to be formatted
    value 2 Arbitrary type Yes Value 2 to be formatted
  • Response

    A formatted string is returned.

  • Function example
    Raw log:
    class: Format
    escape_name: Traditional
    Processing rule:
    e_set("str_format", str_format("{}={}",v("class"),v("escape_name")))
    Processing result:
    class: Format
    escape_name: Traditional
    str_format: Format=Traditional

str_join

  • Function format
    Str_join(delimited string,value 1,value 2,...)
  • Function parameters
    Parameter Type Required Description
    String delimiter Arbitrary type (automatically converted to a string) Yes The identifier of a string delimiter, for example, !, @, #, $, and %
    value 1 Arbitrary type (automatically converted to a string) Yes The value to be connected
    value 2 Arbitrary type (automatically converted to a string) Yes The value to be connected
  • Response

    A connected string is returned.

  • Function example
    Raw log:
    name: ETL
    company: aliyun.com
    Processing rule:
    e_set("email", str_join("@",v("name"),v("company")))
    Processing result:
    name: ETL
    company: aliyun.com
    email:ETL@aliyun.com

str_replace

  • Function format
    str_replace(value, old [,new [,count] ])
    Note This function is a basic method to call variable parameters. For more information, see Function calls.
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The value to be replaced.
    old Arbitrary type (automatically converted to a string) Yes The string to be replaced.
    new Arbitrary type (automatically converted to a string) No The new string after the replacement.
    count Number No The number of times of replacement. The default value is -1, which indicates that all occurrences of the old string are replaced.
  • Response

    A new string is returned.

  • Function example: The following example converts a dictionary to a JSON string.
    Raw log:
    content:  {'referer': '-', 'request': 'GET /phpMyAdmin', 'status': 404, 'data-1': {'aaa': 'Mozilla', 'bbb': 'asde'}, 'data-2': {'up_adde': '-', 'up_host': '-'}}
    Processing rule:
    e_set("content_json", str_replace(ct_str(v("content")),"'",'"'))
    Processing result:
    content:  {'referer': '-', 'request': 'GET /phpMyAdmin', 'status': 404, 'data-1': {'aaa': 'Mozilla', 'bbb': 'asde'}, 'data-2': {'up_adde': '-', 'up_host': '-'}}
    content_json:  {"referer": "-", "request": "GET /phpMyAdmin", "status": 404, "data-1": {"aaa": "Mozilla", "bbb": "asde"}, "data-2": {"up_adde": "-", "up_host": "-"}}

str_sort

  • Function format
    str_sort(value, [reverse])
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be sorted
    reverse Bool No The default value is "False", which indicates sorting in ascending order
  • Response

    A sorted string is returned.

  • Function examples
    • Example 1: This example sorts an str string.
      Raw log:
      str: twish
      Processing rule:
      e_set("str_sort", str_sort(v("str")))
      Processing result:
      str: twish
      str_sort: histw
    • Example 2: This example sorts an str string in pairs in descending order.
      Raw log:
      str: twish
      Processing rule:
      e_set("str_sort", str_sort(v("str"),True))
      Processing result:
      str: twish
      str_sort: wtsih

str_reverse

  • Function format
    str_reverse(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The value to be reversed
  • Response

    A converted string is returned.

  • Function example: The following function reverses the data string.
    Raw log:
    data:twish
    Processing rule:
    e_set("reverse_data", str_reverse(v("data")))
    Processing result:
    data:twish
    reverse_data:hsiwt

str_logstash_config_normalize

  • Function format
    str_logstash_config_normalize(value)
    Note For more information about the Logstash configuration language, visit Logstash.
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The value to be converted
  • Response

    A converted string is returned.

  • Function example: The following example converts the "logstash" string.
    Raw log:
    logstash: {"name"=>"tw5"}
    Processing rule:
    e_set("normalize_data", str_logstash_config_normalize(v("logstash")))
    Processing result:
    logstash: {"name"=>"tw5"}
    normalize_data:{"name":"tw5"}

str_strip

  • Function format
    str_strip(value, [chars] )
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be modified.
    chars Arbitrary type (automatically converted to a string) No The character set to be deleted from the start and end of a string. The default value is \t\r\n.
  • Response

    A modified string is returned.

  • Function examples
    • Example 1: This example deletes the "*" character from the start of the strip string.
      Raw log:
      
      strip: ***I love Etl
      Processing rule:
      
      e_set("str_strip", str_strip(v("strip"),"*"))
      Processing result:
      strip: ***I love Etl
      str_strip:I love Etl
    • Example 2: This example deletes the space character from the start of the strip string.
      Raw log:
      
      strip:    I love Etl
      Processing rule:
      
      e_set("str_strip", str_strip(v("strip")))
      Processing result:
      strip:    I love Etl
      str_strip: I love Etl
    • Example 3: This example deletes the xy character set.
      Raw log:
      
      strip:xy123yx
      Processing rule:
      
      e_set("str_strip", str_strip(v("strip"),"xy"))
      Processing result:
      strip:xy123yx
      str_strip:123

str_lower

  • Function format
    
    str_lower(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be converted
  • Response

    A converted string is returned.

  • Function example: The following example converts the "name" string into lowercase letters.
    Raw log:
    
    name: Etl
    Processing rule:
    
    e_set("str_lower", str_lower(v("name")))
    Processing result:
    name: Etl
    str_lower: etl

str_upper

  • Function format
    
    str_lower(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be converted
  • Response

    A converted string is returned.

  • Function example: The following example converts the "name" string into uppercase letters.
    Raw log:
    
    name: etl
    Processing rule:
    
    e_set("str_upper", str_upper(v("name")))
    Processing result:
    name: etl
    str_upper: ETL

str_title

  • Function format
    
    str_title(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be converted
  • Response

    A converted string is returned.

  • Function example: The following example converts the first letter of all words in the "word" string into an uppercase letter.
    Raw log:
    
    word: this is etl
    Processing rule:
    
    e_set("str_title", str_title(v("word")))
    Processing result:
    word: this is etl
    str_title: This Is Etl

str_capitalize

  • Function format
    
    str_capitalize(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be converted
  • Response

    A converted string is returned.

  • Function example: The following example converts the first letter of all words in the "word" string into a lowercase letter.
    Raw log:
    
    word: this Is MY EAL
    Processing rule:
    
    e_set("str_capitalize", str_capitalize(v("word")))
    Processing result:
    word: this Is MY EAL
    str_capitalize: This is my eal

str_lstrip

  • Function format
    
    str_lstrip(value,[chars])
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be modified.
    chars Arbitrary type (automatically converted to a string) No The character set to be deleted from the start of a string. The default value is the space character.
  • Response

    A modified string is returned.

  • Function examples
    • Example 1: This example deletes the "*" character from the start of the "word" string.
      Raw log:
      
      word: ***this is string
      Processing rule:
      
      e_set("str_lstrip", str_lstrip(v("word"),"*"))
      Processing result:
      word: ***this is string
      str_lstrip: this is string
    • Example 2: This example deletes the space character from the start of the "word" string.
      Raw log:
      
      word:     this is string
      Processing rule:
      
      e_set("str_lstrip", str_lstrip(v("word")))
      Processing result:
      word:     this is string
      str_lstrip: this is string
    • Example 3: This example deletes the xy character set.
      Raw log:
      
      lstrip:xy123yx
      Processing rule:
      
      e_set("str_lstrip", str_lstrip(v("lstrip"),"xy"))
      Processing result:
      lstrip:xy123yxstr_lstrip:123yx

str_rstrip

  • Function format
    
    str_rstrip(value,[chars])
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be modified.
    chars Arbitrary type (automatically converted to a string) No The character set to be deleted from the end of a string. The default value is the space character.
  • Response

    A modified string is returned.

  • Function examples
    • Example 1: This example deletes the "*" character from the end of the "word" string.
      Raw log:
      word: this is string*****
      Processing rule:
      e_set("str_rstrip", str_rstrip(v("word"),"*"))
      Processing result:
      word: this is string*****
      str_rstrip: this is string
    • Example 2: This example deletes the xy character set.
      Raw log:
      word:xy123yxundefined
      Processing rule:
      e_set("str_rstrip", str_rstrip(v("word"),"xy"))
      Processing result:
      word:xy123yx
      str_rstrip:xy123

str_swapcase

  • Function format
    str_swapcase(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be converted
  • Response

    A converted string is returned.

  • Function example
    Raw log:
    name: this is string
    Processing rule:
    e_set("str_swapcase", str_swapcase(v("name")))
    Processing result:
    name: this is string
    str_swapcase: THIS IS STRING

str_translate

  • Function format
    str_translate(value,original character set,mapping character set)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string in which the specified character set is replaced
    original character set Arbitrary type (automatically converted to a string) Yes The original character set
    mapping character set Arbitrary type (automatically converted to a string) Yes The new character set after the replacement
  • Response

    A processed string is returned.

  • Function example
    Raw log:
    name: I love ETL!!!
    Processing rule:
    e_set("str_translate", str_translate(v("name"),"aeiou","12345"))
    Processing result:
    name: I love ETL!!!
    str_translate: I l4v2 ETL!!!

str_endswith

  • Function format
    tr_endwith(value, suffix [, start [, end ] ] )
    Note This function is a basic method to call variable parameters. For more information, see Function calls.
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be checked.
    suffix Arbitrary type (automatically converted to a string) Yes The suffix rule. This parameter can be a string or an element.
    start Number No The position where the string suffix check starts.

    The value "0" indicates the first character and "-1" indicates the last character.

    end Number No The position where the string suffix check ends.

    The value "0" indicates the first character and "-1" indicates the last character.

  • Response

    The message "True" is returned if the string ends with the specified suffix. The message "False" is returned if the string does not end with the specified suffix.

  • Function example
    Raw log:
    name: this is endswith!!!
    Processing rule:
    e_set("str_endswith",str_endswith(v("name"),"!"))
    Processing result:
    name: this is endswith!!!
    str_endswith: True

str_startswith

  • Function format
    str_startswith(value, prefix [, start [, end ] ])
    Note This function is a basic method to call variable parameters. For more information, see Function calls.
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be checked.
    suffix Arbitrary type (automatically converted to a string) Yes The prefix rule. This parameter can be a string or an element.
    start Number No The position where the string prefix check starts.

    The value "0" indicates the first character and "-1" indicates the last character.

    end Number No The position where the string prefix check ends.

    The value "0" indicates the first character and "-1" indicates the last character.

  • Response

    The message "True" is returned if the string starts with the specified prefix. The message "False" is returned if the string does not start with the specified prefix.

  • Function example
    Raw log:
    name: !! this is startwith
    Processing rule:
    e_set("str_startswith",str_startswith(v("name"),"!!"))
    Processing result:
    name: !! this is startwith
    str_startswith: True

str_find

  • Function format
    str_find(value,str [, begin [,end]])
    Note This function is a basic method to call variable parameters. For more information, see Function calls.
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string in which a substring is searched for.
    str Arbitrary type (automatically converted to a string) Yes The substring to be searched for.
    begin Number No The position where the substring search starts.

    The value "0" indicates the first character and "-1" indicates the last character.

    end Number No The position where the substring search ends.

    The default value is the length of the string. The value "0" indicates the first character and "-1" indicates the last character.

  • Response

    The position of the specified substring in the original string is returned.

  • Function example
    Raw log:
    name: hello world
    Processing rule:
    e_set("str_find",str_find(v("name"),"h"))
    Processing result:
    name: hello world
    str_find: 0

str_count

  • Function format
    str_count(value,sub[,start [,end]])
    Note This function is a basic method to call variable parameters. For more information, see Function calls.
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string in which the number of occurrences of a specified character is counted.
    sub Arbitrary type (automatically converted to a string) Yes The character whose number of occurrences is counted.
    start Number No The position where the search for the specified character starts in the string.

    The value "0" indicates the first character and "-1" indicates the last character.

    end Number No The position where the search for the specified character ends in the string.

    The default value is the last character of the string. The value "0" indicates the first character and "-1" indicates the last character.

  • Response

    The number of occurrences of the specified character is returned.

  • Function example
    Raw log:
    name: this is really a string
    Processing rule:
    e_set("str_count",str_count(v("name"),"i"))
    Processing result:
    name: this is really a string
    str_count: 3

str_rfind

  • Function format
    str_rfind(value,substr[,beg [,end]])
    Note This function is a basic method to call variable parameters. For more information, see Function calls.
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string in which a specified character is searched for.
    substr Arbitrary type (automatically converted to a string) Yes The character to be searched for.
    beg Number No The position where the search starts. Default value: 0.
    end Number No The position where the search ends. The default value is the length of the string.
  • Response

    The position of the last occurrence of the specified character.

  • Function example
    Raw log:
    name: this is really a string
    Processing rule:
    e_set("str_rfind",str_rfind(v("name"),"i"))
    Processing result:
    name: this is really a string
    str_rfind: 20

str_split

  • Function format
    str_split(value, sep=None, maxsplit=-1)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be split.
    sep Number No The delimiter. The value "None" indicates the space character.
    maxsplit Number No The maximum number of splits. The value "-1" indicates that no upper limit exists.
  • Response

    A split string is returned.

  • Function example: The following example splits the "content" string with a space character.
    Raw log:
    content: hello world
    Processing rule:
    e_set("str_split",str_split(v("content")," "))
    Processing result:
    content: hello world
    str_split: ["hello", "world"]

str_splitlines

  • Function format
    str_splitlines(value,[keepends])
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be split.
    keepends Bool No Indicates whether to delete line breaks (\r, \r\n, and \n) from the output. The default value is False, which means to delete line breaks. The value True means to reserve line breaks.
  • Response

    A list of split string is returned.

  • Function examples
    • Example 1
      Raw log:
      content: ab c\n\nde fg\rkl\r\n
      Processing rule:
      e_set("str_splitlines",str_splitlines(v("content"),False))
      Processing result:
      content: ab c\n\nde fg\rkl\r\n
      str_splitlines: ['ab c', '', 'de fg', 'kl']
    • Example 2
      Raw log:
      content: ab c\n\nde fg\rkl\r\n
      Processing rule:
      e_set("str_splitlines",str_splitlines(v("content"),True))
      Processing result:
      content: ab c\n\nde fg\rkl\r\n  
      str_splitlines: ['ab c\n', '\n', 'de fg\r', 'kl\r\n']

str_partition

  • Function format
    str_partition(value,substr)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be split
    substr Arbitrary type (automatically converted to a string) No The specified delimiter
  • Response

    A split string is returned.

  • Function example: The following example splits the "website" string with periods (.) into three parts from left to right.
    Raw log:
    website: www.aliyun.com
    Processing rule:
    e_set("str_partition",str_partition(v("website"),"."))
    Processing result:
    website: www.aliyun.com
    str_partition:  ["www", ".", "aliyun.com"]

str_rpartition

  • Function format
    str_rpartition(value,substr)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be split
    substr Arbitrary type (automatically converted to a string) No The specified delimiter
  • Response

    A list of split string is returned.

  • Function example: The following example splits the "website" string with periods (.) into three parts from right to left.
    Raw log:
    website: www.aliyun.com
    Processing rule:
    e_set("str_partition",str_rpartition(v("website"),"."))
    Processing result:
      website: www.aliyun.com
      str_partition: ["www.aliyun", ".", "com"]

str_center

  • Function format
    str_center(value,width,[fillchar])
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be modified.
    width Number Yes The length of the padded string.
    fillchar Arbitrary type (automatically converted to a string) No The pad character. The default pad character is the space character.
  • Response
    A padded string is returned.
    Note The original string is returned if the padded string is shorter than the original string.
  • Function examples
    • Example 1: This example pad a string with asterisks (*).
      Raw log:
      center: this is center
      Processing rule:
      e_set("str_center",str_center(v("center"),width=40,fillchar="*"))
      Processing result:
      center: this is center
      str_center: *************this is center*************
    • Example 2: This example pad a string with space characters.
      Raw log:
      center: this is center
      Processing rule:
      e_set("str_center",str_center(v("center"),width=40))
      Processing result:
      center: this is center
      str_center:              this is center 

str_zfill

  • Function format
    str_zfill(value,width)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be modified
    width Number Yes The length of the padded string
  • Response

    A padded string is returned.

  • Function example
    Raw log:
    center: this is zfill
    Processing rule:
    e_set("str_zfill",str_zfill(v("center"),width=40))
    Processing result:
    center: this is zfill
    str_zfill: 00this is zfill

str_expandtabs

  • Function format
    str_expandtabs(value,[tabsize])
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be modified.
    tabsize Number Yes Specifies the number of space characters after the conversion.
  • Response

    A converted string is returned.

  • Function examples
    • Example 1: This example converts the \t character in the "logstash" string into a space character.
      Raw log:
      logstash: this is\tstring
      Processing rule:
      e_set("str_expandtabs",str_expandtabs(v("center")))
      Processing result:
        logstash: this is\tstring
        str_expandtabs: this is string
    • Example 2: This example converts the \t character in the "logstash" string into space characters.
      Raw log:
      center: this is\tstring
      Processing rule:
      e_set("str_expandtabs",str_expandtabs(v("center"),16))
      Processing result:
      center: this is\tstring
      str_expandtabs: this is         string

str_ljust

  • Function format
    str_ljust(value,width,[fillchar])
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be modified.
    width Number Yes The length of the padded string.
    fillchar Arbitrary type (automatically converted to a string) No The pad character. The default pad character is the space character.
  • Response
    A padded string is returned.
    Note If the length of the padded string is shorter than that of the original string, the original string is returned.
  • Function examples
    • Example 1
      Raw log:
      content: this is ljust
      Processing rule:
      e_set("str_ljust",str_ljust(v("content"),20,"*"))
      Processing result:
      content: this is ljust
      str_ljust: this is ljust*******
    • Example 2
      Raw log:
      center: this is ljust
      Processing rule:
      e_set("str_ljust",str_ljust(v("center"),20,))
      Processing result:
      center: this is ljust
      str_ljust: this is ljust   
    • Example 3: In this example, the original string is returned because the value of the "width" parameter is smaller than the length of the original string.
      Raw log:
      center: this is ljust
      Processing rule:
      e_set("str_ljust",str_ljust(v("center"),10,"*"))
      Processing result:
      center: this is ljust
      str_ljust: this is ljust

str_rjust

  • Function format
    str_ljust(value,width,[fillchar])
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The original string to be modified.
    width Number Yes The length of the padded string.
    fillchar Arbitrary type (automatically converted to a string) No The pad character. The default pad character is the space character.
  • Response
    A padded string is returned.
    Note If the length of the padded string is shorter than that of the original string, the original string is returned.
  • Function example
    Raw log:
    center: this is rjust
    Processing rule:
    e_set("str_rjust",str_rjust(v("center"),20,"*"))
    Processing result:
    center: this is rjust
    str_rjust: *******this is rjust

str_zip

  • Function format
    str_zip(value1, value2, combine_sep=None, sep=None, quote=None, lparse=None, rparse=None)
  • Function parameters
    Parameter Type Required Description
    value 1 Arbitrary type (automatically converted to a string) Yes A value to be combined.
    value 2 Arbitrary type (automatically converted to a string) Yes A value to be combined.
    combine_sep Arbitrary type (automatically converted to a string) No The identifier used to merge the elements. The default identifier is #.
    sep Arbitrary type (automatically converted to a string) No The delimiter between merged elements. It must be a single character. Default value: ,.
    quote Arbitrary type (automatically converted to a string) No The character that encloses the merged elements. This parameter is required when the merged elements contain a delimiter. The default value is ".
    lparse Arbitrary type (automatically converted to a string) No The delimiter and quote used among the elements of value 1. The default delimiter is , and the default quote is ". The format is lparse=(',', '"').
    Note The quote takes precedence over the delimiter.
    rparse Arbitrary type (automatically converted to a string) No The delimiter and quote used among the elements of value 1. The default delimiter is , and the default quote is ". The format is rparse=(',', '"').
    Note The quote takes precedence over the delimiter.
  • Response

    A combined string is returned.

  • Function examples
    • Example 1
      Raw log:
      website: wwww.aliyun.com
      escape_name: o
      Processing rule:
      e_set("combine",str_zip(v("website"),v("escape_name"), combine_sep="@"))
      Processing result:
      website: wwww.aliyun.com
      escape_name: o
      combine: wwww.aliyun.com@o
    • Example 2
      Raw log:
      website: wwww.aliyun.com
      escape_name: o
      Processing rule:
      e_set("combine",str_zip(v("website"),v("escape_name")))
      Processing result:
      website: wwww.aliyun.com
      escape_name: o
      wwww.aliyun.com#o  
    • Example 3: In this example, the "sep" parameter is specified.
      Raw log:
      f1: a,b,c
      f2: x,y,z
      Processing rule:
      e_set("combine",str_zip(v("f1"), v("f2"), sep="|"))
      Processing result:
      f1: a,b,c
      f2: x,y,z
      combine: a#x|b#y|c#z
    • Example 4: In this example, the "quote" parameter is specified.
      Raw log:
      f1: "a,a", b, "c,c"
      f2: x, "y,y", z
      Processing rule:
      e_set("combine",str_zip(v("f1"), v("f2"), quote='|'))
      Processing result:
      f1: "a,a", b, "c,c"
      f2: x, "y,y", z
      combine: |a,a#x|,|b#y,y|,|c,c#z|
    • Example 5: In this example, elements of different lengths are used.
      Raw log:
      f1: a,b
      f2: x,y,z
      Processing rule:
      e_set("combine",str_zip(v("f1"), v("f2")))
      Processing result:
      f1: a,b
      f2: x,y,z
      combine: a#x,b#y
    • Example 6: In this example, the "lparse" and "rparse" parameters are specified.
      Raw log:
      f1: a#b#c
      f2: x|y|z
      Processing rule:
      e_set("combine",str_zip(v("f1"), v("f2"), lparse=("#", '"'), rparse=("|", '"')))
      Processing result:
      f1: a#b#c
      f2: x|y|z
      combine: a#x,b#y,c#z
    • Example 7: In this example, the "lparse" and "rparse" parameter are specified.
      Raw log:
      f1: |a,a|, b, |c,c|
      f2: x, #y,y#, z
      Processing rule:
      e_set("combine",str_zip(v("f1"), v("f2"), lparse=(",", '|'), rparse=(",", '#')))
      Processing result:
      f1: |a,a|, b, |c,c|
      f2: x, #y,y#, z
      combine: "a,a#x","b#y,y","c,c#z"

str_isalnum

  • Function format
    str_isalnum(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    content: 13
    Processing rule:
    e_set("str_isalnum",str_isalnum(v("content")))
    Processing result:
    content: 13
    str_isalnum: True

str_isalpha

  • Function format
    str_isalpha(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned?

  • Function example
    Raw log:
    content: 13
    Processing rule:
    e_set("str_isalpha",str_isalpha(v("content")))
    Processing result:
    content: 13
    str_isalpha: False

str_isascii

  • Function format
    str_isascii(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    content: asw123
    Processing rule:
    e_set("str_isascii",str_isascii(v("content")))
    Processing result:
    content: asw123
    str_isascii: True

str_isdecimal

  • Function format
    str_isdecimal(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function examples
    • Example 1
      Raw log:
      welcome: hello
      Processing rule:
      e_set("str_isdecimal",str_isdecimal(v("welcome")))
      Processing result:
      welcome: hello
      str_isdecimal: False
    • Example 1
      Raw log:
      num: 123
      Processing rule:
      e_set("str_isdecimal",str_isdecimal(v("num")))
      Processing result:
      num: 123
      str_isdecimal: True

str_isdigit

  • Function format
    str_isdigit(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    content: 13
    Processing rule:
    e_set("str_isdigit",str_isdigit(v("content")))
    Processing result:
    content: 13
    str_isdigit: True

str_isidentifier

  • Function format
    str_isidentifier(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    class: class
    Processing rule:
    e_set("str_isidentifier",str_isidentifier(v("class")))
    Processing result:
    class: class
    str_isidentifier: True

str_islower

  • Function format
    str_islower(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    lower: asds
    Processing rule:
    e_set("str_islower",str_islower(v("lower")))
    Processing result:
    lower: asds
    str_islower: True

str_isnumeric

  • Function format
    str_isnumeric(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    num: 123
    Processing rule:
    e_set("str_isnumeric",str_isnumeric(v("num")))
    Processing result:
    num: 123
    str_isnumeric: True

str_isprintable

  • Function format
    str_isprintable(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    content: vs;,.as
    Processing rule:
    e_set("str_isprintable",str_isprintable(v("content")))
    Processing result:
    content: vs;,.as
    str_isprintable: True

str_isspace

  • Function format
    str_isspace(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    space:  as afsd
    Processing rule:
    e_set("str_isspace",str_isspace(v("space")))
    Processing result:
    space:  as afsd
    str_isspace: False

str_istitle

  • Function format
    str_istitle(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    title: Alex
    Processing rule:
    e_set("str_istitle",str_istitle(v("title")))
    Processing result:
    title: Alex
    str_istitle: True

str_isupper

  • Function format
    str_istitle(value)
  • Function parameters
    Parameter Type Required Description
    value Arbitrary type (automatically converted to a string) Yes The string to be checked
  • Response

    The message "True" or "False" is returned.

  • Function example
    Raw log:
    content: ASSD
    Processing rule:
    e_set("str_isupper",str_isupper(v("content")))
    Processing result:
    content: ASSD
    str_isupper: True

str_uuid

  • Function format
    str_uuid(lower=True)
  • Function parameters
    Parameter Type Required Description
    lower Bool No Indicates whether the letters in the generated UUID are in lowercase. The default value is "True", which indicates that the letters are in lowercase.
  • Response

    A UUID is returned.

  • Function examples
    • Example 1
      Raw log:
      content: I am Iran man
      Processing rule:
      e_set("UUID",str_uuid())
      Processing result:
      content: I am Iran man
      UUID: dcc54d7e-c95f-11e9-9791-ffd6754a4f32
    • Example 2
      Raw log:
      content: I am Iran man
      Processing rule:
      e_set("UUID",str_uuid(lower=False))
      Processing result:
      content: I am Iran man
      UUID: DCC72D74-C95F-11E9-9921-F395B8647FFA