Generating a Number with Specified Decimal Places
Function Name
$numberFormat(double number,int A)
Function Description
Generates a number with a specified number of decimal places.
Parameter number supports the following types:
- Numbers
- Environment parameters
- Local parameters
- Other built-in functions
Parameter A is the number of digits you want to reserve, which ranges from 0 to 20. For example, if the function $numberFormat(3.14,0) is used, the decimal places will not be retained and the number 3 will be returned.
Application Scenarios
This function can be used in the following parts of an API automation test case. (Do not use this function for environment parameters. Otherwise, what is input will be output.)
- Request URL
- Request header
- Request body
- Checkpoint property
- if condition
- for loop interrupt condition
Example
- Request URL
As shown in the following figure, the value of the test parameter in the request URL is the function for generating a number with a specified number of decimal places. Parameters number and A in the function are 3.14 and 0, respectively.

- Request header
As shown in the following figure, the value of the number parameter in the request header is the function for generating a number with a specified number of decimal places. Parameter number in the function is a function for random generation of decimals within a specified range, and parameter A is 0.

What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot