Reputation: 503
String buffer = "c";
Conversion by Decimal. I wanna change buffer value to decimal value.
In ASCII Table
DEC HEX CHAR
99 63 c
So, Finally
buffer -> 99 ( return value int or String and something )
How Can I Change that value?
Integer.parseInt(buffer, 12) -> returns 12
But I wanna get 99
is it Possible to conversion?
Upvotes: 0
Views: 17260
Reputation: 140
String buffer = "c";
char ch = buffer.charAt(0);
System.out.println((int)ch);
This should do it.
Upvotes: 2
Reputation: 1
String buffer = "abc";
for(int i=0;i<buffer.length();i++)
{
System.out.println((int)buffer.charAt(i));
}
Upvotes: 0
Reputation: 44854
try
System.out.println((int)ch);
where ch is a char
Of course in you code you have a string, so maybe you need to get the first char or something
Upvotes: 0