Question

How to convert Strings to unicode? Characters are easy. But if I have "C" stored as a String, how can convert it to unicode? Because for characters, you just can use (int)charvariable but how to do for strings?

Actually I am using String.split() to split a String and then want to check if the 1st character is capital or small. Integer.parseInt is not working. It says NumberFormatException.

Was it helpful?

Solution

You may try this -

byte[] bytes = new byte[10];

String str = new String(bytes, Charset.forName("UTF-8"));

System.out.println(str);

for more detail you can see this tutorial

and for checking the first character you my use str.CharAt(0)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top