overpunch

Function convert_to_signed_format

source
pub fn convert_to_signed_format(
    value: Decimal,
    field_format: &str,
) -> Option<String>
Expand description

Returns a str serialized from a Decimal to the appropriate signed overpunch respresentation.

§Arguments

  • value - The Decimal value to serialize.
  • field_format - The signed overpunch picture format.

§Example


let formatted = convert_to_signed_format(Decimal::from_str_exact("225.8").unwrap(), "s9(7)v99").unwrap();
assert_eq!(formatted, "2258{");