I am reading a floating point attribute value from a node in an XML file with TXMLDocument
:
<MyApp_Favorites version="1.0">
...with this statement:
var
ThisRootNode: IXMLNode;
ThisVersion: Single;
// ...
ThisVersion := ThisRootNode.Attributes['version'];
CodeSite.Send('ThisVersion', ThisVersion);
However, on my German language system I get this version value:
ThisVersion = 10,00
...as in my regional settings the comma "," is defined as decimal separator and not the dot "." as in the XML file. But with an English language regional setting - where the dot is most probably defined as decimal separator setting - the result will be correct as "1.0".
So how can I make sure that independently from the regional setting the read VALUE of 1.0 will be always the same? (Reading the version value as string and then convert it to float doesn't seem to be a very elegant method).
A floating point number isn't a sensible format for a version number, rounding errors and lack of representability being major drawbacks. Consider using a record with integers to define the version numbers.