Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Error_StringToDecimalParse

$
0
0

Isn't the difference here about how the system culture is set up?  The documentation for the Parse method says:

Parameter s is parsed using the formatting information in a NumberFormatInfo initialized for the current system culture. For more information, see CurrentInfo. To parse a string using the formatting information of some other culture, use the Decimal.Parse(String, IFormatProvider) or Decimal.Parse(String, NumberStyles, IFormatProvider) method.

If the system culture is set up to a culture in which the thousands separator is '.' and the decimal separator is ',', then effectively any '.' character in the input string will be ignored.  So it is expected behaviour that the statement:

    move decimal::Parse(ws-str1) to ws-number  *> HERE ws-number = (+23412.00)

...will produce the answer +23412.00 when the input string is  1234.12 (since the leading digit will be truncated).


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>