Tuesday, July 14, 2009

From C to Java?

in C ; when i have a variable called for example first; i can say 'first' and it returns to me the ASCII of the value of that variable, either it was character,integer,.....; How can i do this in Java (i want a method or a syntax that enables me to get the Unicode value of any Object)

From C to Java?
well you can type cast a variable





example





char myChar = 'A';


int myInt = (int)myChar;





it will return the ascii value of that char











or





string str = new string("blah");








str.getBytes() // returns a array of character encodeing





good luck


No comments:

Post a Comment