Share this page

# lr_convert_double_to_integer

Converts the string representation of a double value to the string representation of an integer.

    int lr_convert_double_to_integer( char *source_param_name, char * target_param_name );

## Arguments

Name | Comments
--- | ---
source_param_name | The name of the parameter containing the double to be converted.
target_param_name | The parameter to contain the output integer.

lr_convert_double_to_integer converts the string representation of a double value to an integer string by discarding the fractional part of the double. The target parameter is created if it does not exist.

If the input string is not a pure number string, as many characters as possible are converted. The rest are ignored. A string that does not begin with a character that can be converted causes an error.

For example:

- “1234ABCDF” is converted to 1234.
- “312.123.32.23123” is converted to 312.123 .
- “MyProduct” and “ABC123PC” cause errors.

## Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

## Parameterization

Standard parameterization is not available for this function.

## Example

In the following example, lr_convert_double_to_integer converts the string representation of a double to the string representation of an int.

Copy code

    lr_save_string("1.0502731456E7","sourceParam");
    lr_save_string("10062731.0","sourceParam2");

    lr_convert_double_to_integer("sourceParam","outparam");
    lr_output_message("[%s] converted to: [%s]",
    lr_eval_string("{sourceParam}"),lr_eval_string("{outparam}"));

    lr_convert_double_to_integer("sourceParam2","outparam");
    lr_output_message("[%s] converted to: [%s]",
    lr_eval_string("{sourceParam2}"),lr_eval_string("{outparam}"));

    Example: Output:
    Action.c(16): [1.0502731456E7] converted to: [10502731]
    Action.c(19): [10062731.0] converted to: [10062731]

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: