Altova MapForce 2023 Enterprise Edition

The parse-number function (see below) converts a string into a decimal number according to a specified pattern. The function uses the pattern to determine only the prefix, suffix and digit grouping. The actual length of the number is not checked against the pattern. If the input value is longer or shorter than specified by the pattern, this will be ignored in the checking.

mf-func-parse-number

 

Languages

Built-in, C++, C#, Java.

 

Parameters

Argument

Description

value

The string to be converted to a number.

format

Optional argument. A format string that identifies the way in which the number is currently formatted. The format string is the same as that used in format-number.

 

Default is "#,##0.#"

decimal-point-character

Optional argument. Specifies the character to be used as the decimal point character. Default is the '.' character.

grouping-separator

Optional argument. Specifies the separator/delimiter used to separate groups of numbers. Default is the "," character.

 

Example

The following mapping parses the string value "1,234.50" to a decimal equivalent, by using the format mask #,##0.00. In this mapping , there is no need to connect the decimal-point-character and grouping-separator arguments, since their default values match the format of the input string.

mf-func-parse-number-example

The output (excluding the XML and namespace declarations) is shown below:

 

<Article>
  <Number>1</Number>
  <Name>Office chair</Name>
  <SinglePrice>1234.5</SinglePrice>
</Article>

 

© 2016-2022 Altova GmbH