github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/strfmt.en.md (about)

     1  ### `strfmt()` {#fn-strfmt}
     2  
     3  Function prototype: `fn strfmt(key, fmt: str, args ...: int|float|bool|str|list|map|nil)`
     4  
     5  Function description: Format the content of the field specified by the extracted `arg1, arg2, ...` according to `fmt`, and write the formatted content into the `key` field
     6  
     7  Function parameters:
     8  
     9  - `key`: Specify the field name of the formatted data to be written
    10  - `fmt`: format string template
    11  - `args`: Variable Function parameters:, which can be multiple extracted field names to be formatted
    12  
    13  Example:
    14  
    15  ```python
    16  # Data to be processed: {"a":{"first":2.3,"second":2,"third":"abc","forth":true},"age":47}
    17  
    18  # process script
    19  json(_, a.second)
    20  json(_, a.thrid)
    21  cast(a. second, "int")
    22  json(_, a.forth)
    23  strfmt(bb, "%v %s %v", a.second, a.thrid, a.forth)
    24  ```