到目前为止,我想根据 Ç (带有 cedilla 的拉丁大写字母 C)拆分字符串,我已经尝试过 string.split、Splitter.on(pattern).split(line)
Ç有unicode 00C7
到目前为止,我想根据 Ç (带有 cedilla 的拉丁大写字母 C)拆分字符串,我已经尝试过 string.split、Splitter.on(pattern).split(line)
Ç有unicode 00C7
如果您的 java 源文件应该是 UTF-8 格式,那么这非常有效:
String[] token = s.split("Ç");
如果没有,请使用
String[] token = s.split("\u00C7"); // Ç
但这可读性要差得多
尝试
String s = "I want to split a string based on Ç (Latin Capital letter C with cedilla) so far i have tried string.split, Splitter.on(pattern).split(line)\n" +
"\n" +
"Ç has unicode 00C7";
for(String part: s.split("Ç"))
System.out.println("["+part+"]");
印刷
[I want to split a string based on ]
[ (Latin Capital letter C with cedilla) so far i have tried string.split, Splitter.on(pattern).split(line)
]
[ has unicode 00C7]