你說一個字符串,所以這可能幫助。這是一個從很長一段時間前,所以... :)
Dim IntPart, DecPart
''Format for this locale
cur = (Format(cur, "#,###.00"))
''This locale uses stop as decimal separator
''Change the "." to the decimal separator for your locale
If InStr(1, cur, ".") > 0 Then
DecPart = Mid(cur, InStr(1, cur, ".") + 1)
Else
DecPart = "00"
End If
''Ditto, change the stop.
IntPart = Mid(cur, 1, InStr(1, cur, ".") - 1)
''This locale uses comma for thousands separator,
''so change the "," to the thousands separator for your locale
''and ="." to the required replacement separator
Do While InStr(1, IntPart, ",") > 0
Mid(IntPart, InStr(1, IntPart, ","), 1) = "."
Loop
''This set the decimal separator to a comma,
''choose the separator required.
EUCurrency = IntPart & "," & DecPart
嗯,我認爲更多有關像FormatSpecial(num,「##。##」,Culture:=「de」)'這樣的形式更優雅(和簡潔)的東西。但由於這似乎並不存在,我將使用'Replace(Format(CStr(n),「##。##」),「,」,「。」)''。我處理的數字都很小,所以我不需要關心千位分隔符。不過,謝謝你的努力。 – phg 2012-04-25 07:57:00