Question
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
Solution
If your java source file is in UTF-8 as it should be, this perfectly works :
String[] token = s.split("Ç");
If not, use
String[] token = s.split("\u00C7"); // Ç
but this is much less readable
OTHER TIPS
Try
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+"]");
prints
[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]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow