International : Thousand Sep and Decimal Sep

  Dim s As String
  s=Format(-999999.999,"-###,###.###")
  thousand_sep=Mid(s,5,1) // could be period, comma, space, apostrophe or nothing
  If thousand_sep="9" Then thousand_sep="" ' none
  decimal_sep=Mid(s,Len(s)-3,1) ' could be period or comma

Is there any reason that this will not return the correct Thousand and Decimal seperators based on the users current settings (for both OSX and Windows)?

I have tested it by changed the values on OSX and it seems to work, I just want to make sure there are not any pitfalls involved…

Here’s one. If it’s set to an Indian locale, you may get the digit zero for each–they have a different comma pattern, yielding 9,99,999.999 (with the localized characters).

why not the position insensitive

Dim s As String s=Format(9999,"#,###") thousand_sep = replaceall(s,"9","") s=Format(99.99,"##.##") decimal_sep = replaceall(s,"9","")
And it even handles the case where, like OS X allows, someone set the decimal or thousands char to be several characters :stuck_out_tongue: