Page 3 of 3

Posted: Thu Jan 25, 2007 2:50 pm
by Shardik
AND51 wrote: But what about the SetLocale-Line? I left it out and it also works!
But it only works after you have run it with the SetLocaleInfo() function just once. The #LOCALE_IDIGITS value is stored in your windows user profile. So even after a reboot or after power down and a new start this value remains untouched.
AND51 wrote: Actually, I want a procedure containing everything which is needed to convert my numbers; I don't want any calls outside this procedure.
You can put the SetLocaleInfo_() function into the FormatNumber() procedure after a previous test with GetLocaleInfo_() to check whether the number of digits has to be changed.

Code: Select all

Procedure.s FormatNumber(Number.Q)
  Protected Buffer.S = Space(4) 

  GetLocaleInfo_(#LOCALE_USER_DEFAULT, #LOCALE_IDIGITS, @Buffer, Len(Buffer))

  If Buffer <> "0"
    Debug SetLocaleInfo_(#LOCALE_USER_DEFAULT, #LOCALE_IDIGITS, @"0")
  EndIf

  Buffer.S = Space(128)
  GetNumberFormat_(#LOCALE_USER_DEFAULT, 0, StrQ(Number), 0, @Buffer, Len(Buffer)) 
  ProcedureReturn Buffer 
EndProcedure 

Debug FormatNumber(1234567890)