如何用Java编写区域设置代码

时间:2017-07-27 08:33:41

标签: java vba vbscript regional-settings

有人可以帮我理解下面的VB代码。 我必须编写相应的Java代码。但我无法理解VB代码。这是关于修改区域设置。

Dim sTemp As String
mstrDecimalSepChar = OS_GetRegionalSetting(DecimalSeparator)
OS_SetRegionalSetting DecimalSeparator, "."
sTemp = OS_GetRegionalSetting(DecimalSeparator)

mstrThousandsSepChar = OS_GetRegionalSetting(ThousandsSeparator)
OS_SetRegionalSetting ThousandsSeparator, ","
sTemp = sTemp & OS_GetRegionalSetting(ThousandsSeparator)

SetRegionalSettings = (sTemp = ".,")

1 个答案:

答案 0 :(得分:0)

Dim sTemp As String

mstrDecimalSepChar = OS_GetRegionalSetting(DecimalSeparator)       ' save current system setting for the separator
OS_SetRegionalSetting DecimalSeparator, "."                        ' set separator to "."

mstrThousandsSepChar = OS_GetRegionalSetting(ThousandsSeparator)   ' save current system setting for the separator
OS_SetRegionalSetting ThousandsSeparator, ","                      ' set separator to ","

sTemp = OS_GetRegionalSetting(DecimalSeparator)                    ' retrieve the system settings of the two separators
sTemp = sTemp & OS_GetRegionalSetting(ThousandsSeparator)

SetRegionalSettings = (sTemp = ".,")                               ' return True if separators are now "." and "," in system settings