How to read #39;List separator#39; from OS in Java?(如何从 Java 中的操作系统读取“列表分隔符?)
问题描述
我正在用 Java 编写一个 CSV 导出器,它应该尊重用户的自定义设置,尤其是用作分隔符的列表分隔符".
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.
在 Windows 中,可以设置此列表分隔符
In Windows, one can set this List separator in
Control Panel -> Regional and Language Options -> Regional Options -> Customize
我不了解其他操作系统,但我很确定您也可以在其他操作系统上进行更改.
I don't know about the other operating systems, but I'm pretty sure that you can change that on other OSes, too.
将此自定义设置从操作系统导入 Java 的最佳方法是什么?我在 Eclipse RCP 环境中,所以如果有可用的东西,我可能会使用 RCP 相关的解决方案.
What is the best way to get this custom setting from the OS into Java? I am in an Eclipse RCP environment, so I might use RCP-related solutions if there is something available.
推荐答案
来自 这个答案:
阅读特定于操作系统的设置是我必须满足的需求.
Reading the OS-specific setting is a need I have to meet.
如果 Windows 以外的操作系统没有这样的设置怎么办?
So what if OSs other than Windows don't have such a setting?
我建议你从 Windows 上的注册表中读取它(正如提到的 这里):读/写到Windows注册表使用 Java.在其他平台上,只需使用一个好的默认值,也许,至少在 Unix 上,还支持通过自定义环境变量(您记录得很好)来配置它:我的 java 代码如何读取操作系统环境变量?.
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.
这篇关于如何从 Java 中的操作系统读取“列表分隔符"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何从 Java 中的操作系统读取“列表分隔符&quo
基础教程推荐
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 如何对 Java Hashmap 中的值求和 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
