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.

Était-ce utile?

La 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)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top