How to read 'List separator' from OS in Java?

前端 未结 7 2145
我寻月下人不归
我寻月下人不归 2020-12-20 16:33

I am writing a CSV exporter in Java that should respect the user\'s custom settings, especially the \"List separator\" to use as a delimiter.

In Windows, one can set

7条回答
  •  离开以前
    2020-12-20 16:58

    For windows it's stored in the registry at:

    "HKEY_CURRENT_USER\\Control Panel\\International"
    

    so you can use something like this

    private void setDelimiterProperties(String delimiter) {
        Properties p = new Properties();
        String key = "HKEY_CURRENT_USER\\Control Panel\\International\\sList";
        p.setProperty(key, delimiter);
    }
    

提交回复
热议问题