Share this page

# Example: lr_convert_double_to_double

In the following example, lr_convert_double_to_double converts the string representation of a double to several other string representations.

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

    lr_convert_double_to_double("sourceParam","%.2f","outparam");
    lr_output_message("[%s] converted to: [%s]",
    lr_eval_string("{sourceParam}"),lr_eval_string("{outparam}"));

    lr_convert_double_to_double("sourceParam","%.3f","outparam");
    lr_output_message("[%s] converted to: [%s]",
    lr_eval_string("{sourceParam}"),lr_eval_string("{outparam}"));

    lr_convert_double_to_double("sourceParam","%.0f","outparam");
    lr_output_message("[%s] converted to: [%s]",
    lr_eval_string("{sourceParam}"),lr_eval_string("{outparam}"));

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

    Example: Output:
    Action.c(9): [1.0502731456E7] converted to: [10502731.46]
    Action.c(12): [1.0502731456E7] converted to: [10502731.456]
    Action.c(15): [1.0502731456E7] converted to: [10502731]
    Action.c(18): [10062731.0] converted to: [1.0062731E+007]

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