char ch = 'A';
int code = ch;
Now you have the decimal equivalent in code
.
If you have a String
you should do this for each char
from the String
.
Domanda
I'm trying to build an application that receives UDP string messages and then converts the string of characters in the packet to their decimal equivilents, i've tried a few methods and done some research but I cant seem to make any progress on this, i'm sure there must be a smart and easy way of doing this. Could anyone help me on this at all? thanks
Soluzione
char ch = 'A';
int code = ch;
Now you have the decimal equivalent in code
.
If you have a String
you should do this for each char
from the String
.
Altri suggerimenti
You can get the decimal equivalent of ascii like this,
int i='a';
System.out.println("i:="+i);