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

前端 未结 7 2157
我寻月下人不归
我寻月下人不归 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:53

    From comments of this answer:

    Reading the OS-specific setting is a need I have to meet.

    So what if OSs other than Windows don't have such a setting?

    I suggest you read it from registry on Windows (as alluded here): Read/write to Windows Registry using Java. On other platforms just use a good default, and perhaps, at least on Unix, also support configuring it via a custom environment variable (which you document well): How can my java code read OS environment variables?.

    My gut feeling that OSs universally do not have a (system-wide or user-specific) "List separator" setting may be wrong, of course, but I doubt that.

提交回复
热议问题