Post Reply 
will this always return the current system decimal separator? (SOLVED)
02-05-2018, 09:54 AM (This post was last modified: 02-05-2018 10:21 AM by Didier Lachieze.)
Post: #2
RE: will this always return the current system decimal separator?
(02-05-2018 08:32 AM)StephenG1CMZ Wrote:  This seems to work - but could there be a "fix 0" mode which might hide the separator?

It doesn't work in FIX 0 as in this number format mode STRING(π) returns "3".

Instead, you can use the Home Settings variable HSeparator, this should work whatever the number format:

Code:
EXPORT DecSepNow()
//RETURN current system decimal separator
BEGIN
  RETURN IFTE((HSeparator MOD 9)<4,".",",");
END;

Another way of doing it based on your program would be to force the number of digits after the decimal separator:

Code:
EXPORT DecSepNow()
//RETURN current system decimal separator
BEGIN
 LOCAL ST,ND:=HDigits;
 HDigits:=1;     //Set number of digits after the decimal separator to 1
 ST:=STRING(π);  //Set ST to "3.1" or "3,1"
 HDigits:=ND;    //Restore number of digits after the decimal separator
 RETURN ST(2,1); //Return second character of ST
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: will this always return the current system decimal separator? - Didier Lachieze - 02-05-2018 09:54 AM



User(s) browsing this thread: 1 Guest(s)