All Products
Search
Document Center

Simple Log Service:Conversion functions

Last Updated:Jun 16, 2026

Conversion functions convert field or expression values between data types and numeral systems. This topic covers the syntax, parameters, and examples for each function.

Functions

Category

Function Name

Description

Basic type conversion

ct_int

Converts the value of a field or an expression to an integer.

ct_float

Converts the value of a field or an expression to a floating-point number.

ct_str

Converts the value of a field or an expression to a string.

ct_bool

Converts the value of a field or an expression to a Boolean value.

Number conversion

ct_chr

Converts the ANSI or Unicode value of a field or an expression to the corresponding character.

ct_ord

Converts a character in a field or an expression to its corresponding ANSI or Unicode value.

ct_hex

Converts the numeric value of a field or an expression to a hexadecimal number.

ct_oct

Converts the numeric value of a field or an expression to an octal number.

ct_bin

Converts the numeric value of a field or an expression to a binary number.

Numeral system conversion

bin2oct

Converts a binary number to an octal number.

bin2hex

Converts a binary number to a hexadecimal string.

ct_int

Converts the value of a field or expression to an integer.

  • Syntax

    ct_int(value, base=10)
  • Parameters

    Parameter Name

    Type

    Required

    Description

    value

    Number or numeric string

    Yes

    The value to convert.

    base

    Number

    No

    The base of the input value's numeral system. The default is 10 for decimal. For example, setting base to 8 converts an octal number to a decimal number.

  • Response

    Returns an integer value.

  • Examples

    • Example 1: Convert a string to an integer.

      • Raw log

        number: 2
      • Transformation rule

        e_set("int_number", ct_int(v("number")))
      • Result

        number: 2
        int_number:  2
    • Example 2: Convert a hexadecimal number to a decimal number.

      • Raw log

        number: AB
      • Transformation rule

        e_set("int_number", ct_int(v("number"),base=16))
      • Result

        number: AB
        int_number:  171

ct_float

Converts the value of a field or expression to a floating-point number.

  • Syntax

    ct_float(value)
  • Parameters

    Parameter name

    Parameter type

    Required

    Description

    value

    Number or numeric string

    Yes

    The value to convert.

  • Response

    Returns a floating-point number.

  • Examples

    • Raw log

      price: 2
    • Transformation rule

      e_set("price_float", ct_float(v("price")))
    • Result

      price: 2
      price_float:  2.0

ct_str

Converts the value of a field or expression to a string.

  • Syntax

    ct_str(value)
  • Parameters

    Parameter Name

    Parameter Type

    Required

    Description

    value

    Any

    Yes

    The value to convert.

  • Response

    Returns a string.

  • Examples

    • Transformation rule

      e_set("ct_str", ct_str(b'test byte'))
    • Result

      ct_str: test byte

ct_bool

Converts the value of a field or expression to a Boolean value. For more information about the true and false evaluation for different data types, see True and false evaluation.

  • Syntax

    ct_bool(value)
  • Parameters

    Parameter Name

    Parameter Type

    Required

    Description

    value

    Any

    Yes

    The value to convert.

  • Response

    Returns a Boolean value.

  • Examples

    • Raw log

      num: 2
    • Transformation rule

      e_set("ct_bool", ct_bool(v("num")))
    • Result

      num: 2
      ct_bool: true

ct_chr

Converts the ANSI or Unicode value of a field or expression to the corresponding character.

  • Syntax

    ct_chr(value)
  • Parameters

    Parameter name

    Parameter Type

    Required

    Description

    value

    Number or numeric string

    Yes

    The value to convert.

  • Response

    Returns the corresponding character.

  • Examples

    • Raw log

      number: 78
    • Transformation rule

      e_set("ct_chr", ct_chr(v("number")))
    • Result

      number: 78
      ct_chr: N

ct_ord

Converts a character in a field or expression to its corresponding ANSI or Unicode value.

  • Syntax

    ct_ord(value)
  • Parameters

    Parameter Name

    Parameter type

    Required

    Description

    value

    String

    Yes

    The character to convert. The length of the string must be 1.

  • Response

    Returns the corresponding ANSI or Unicode value.

  • Examples

    • Raw log

      world: a
    • Transformation rule

      e_set("ct_ord", ct_ord(v("world")))
    • Result

      world: a
      ct_ord: 97

ct_hex

Converts a numeric value of a field or expression to a hexadecimal number.

  • Syntax

    ct_hex(value)
  • Parameters

    Parameter Name

    Parameter type

    Required

    Description

    value

    Number or numeric string

    Yes

    The value to convert.

  • Response

    Returns a hexadecimal value.

  • Examples

    • Raw log

      number: 123
    • Transformation rule

      e_set("ct_hex", ct_hex(v("number")))
    • Result

      number: 123
      ct_hex: 0x7b

ct_oct

Converts a numeric value of a field or expression to an octal number.

  • Syntax

    ct_oct(value)
  • Parameters

    Parameter Name

    Parameter type

    Required

    Description

    value

    Number or numeric string

    Yes

    The value to convert.

  • Response

    Returns an octal value.

  • Examples

    • Raw log

      number: 123
    • Transformation rule

      e_set("ct_oct", ct_oct(v("number")))
    • Result

      number: 123
      ct_oct: 0o173

ct_bin

Converts a numeric value of a field or expression to a binary number.

  • Syntax

    ct_bin(value)
  • Parameters

    Parameter Name

    Parameter type

    Required

    Description

    value

    Number or numeric string

    Yes

    The value to convert.

  • Response

    Returns a binary value.

  • Examples

    • Raw log

      number: 123
    • Transformation rule

      e_set("ct_bin", ct_bin(v("number")))
    • Result

      number: 123
      ct_bin: 0b1111011

bin2oct

Converts a binary number to an octal number.

  • Syntax

    bin2oct(binary)
  • Parameters

    Parameter Name

    Parameter type

    Required

    Description

    binary

    Binary

    Yes

    A string of the Binary type.

  • Response

    Returns an octal string.

  • Examples

    • Raw log

      test : test
    • Transformation rule

      e_set("new",bin2oct(base64_decoding("ARi8WnFiLAAACHcAGgkADV37Xs8BXftezgAdqwF9")))
    • Result

      test : test
      new : 214274264705421300000002073400064044000325677327547401273755366340003552600575

bin2hex

Converts a binary number to a hexadecimal string.

  • Syntax

    bin2hex(binary)
  • Parameters

    Parameter Name

    Parameter type

    Required

    Description

    binary

    Binary

    Yes

    A string of the Binary type.

  • Response

    Returns a hexadecimal string.

  • Examples

    • Raw log

      test : test
    • Transformation rule

      e_set("new",bin2hex(base64_decoding("ARi8WnFiLAAACHcAGgkADV37Xs8BXftezgAdqwF9")))
    • Result

      test : test
      new : 0118bc5a71622c00000877001a09000d5dfb5ecf015dfb5ece001dab017d