PadZeros

Adds zeros (0) to the beginning of the string, until the string reaches the specified length.

python · Filters And Transformers

Details

IDPadZeros
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10404775
Tagstransformer string number

README

Adds zeros (0) to the beginning of the string, until the string reaches the specified length.

Script Data


Name Description
Script Type python3
Tags transformer, string, number
Cortex XSOAR Version 5.0.0

Inputs


Argument Name Description
value String to pad with zeros.
length The desired length of the string. The value specified in the “value” argument will be padded with zeros until the string reaches this length.

Outputs


There are no outputs for this script.

import demistomock as demisto
from PadZeros import main


def test_pad_zeros(mocker):
    mocker.patch.object(demisto, "args", return_value={"value": "somanyzeros", "length": 15})
    mocker.patch.object(demisto, "results")
    main()
    assert demisto.results.call_count == 1
    results = demisto.results.call_args[0]
    assert len(results) == 1
    assert results[0] == "0000somanyzeros"