Type Cast
Last updated
Last updated
The Type Cast action in the Avo Assure is found under the @Generic Element is used to convert the format from one variable to other and store the result in an output variable for further use.
Input: <Variable>;<typecast type>
1. Typecast type: It changes the type of data from one form to another so it can be used in the right way.
It takes the values in different ways shown as below:
Int (Integer): It is used to store numbers without any decimal or fractional part. It used to convert from another type to integer type (double to int, float to int).
Float: The float is used to convert numbers into decimal point. It used to convert from another type to float type (double to float, int to float).
Double: A double variable that stores numeric values with decimal points, such as floating-point numbers. It used to convert from another type to integer (int to double, float to double).
String: values of string variables may include numbers, letters, or symbols. It used to convert date type to string.
Output: <Display Variable>;<Display Variable>(Optional)
When a user is testing a user registration form for a web application, one of the fields is “Student Marks,” which is expected to be of float type. However, users can enter their marks as a string (e.g., “98”) when filling out the form. The user wants their marks to be converted to float type (e.g., “98.0”). This process involves converting the string value to a float.
Input: In input values user supposed to give input values as followed:
98;float
Expected Result: The application accepts the input and stores the marks as 98.0 (float type).
Output: The result of Type Cast action is stored in the {result} output variable as “98.0” (Float type), which can be utilized for display or other purposes.