Lamis
Lamis

Reputation: 466

Returns the ASCII value as an integer in Java

I'm trying to get the Ascii value of character but I'm a bit clueless

So far I've found

 Character.getNumericValue

But when I read the documentation it says

Returns the int value that the specified Unicode character

In php I used to use ord(string String)

So will Character.getNumericValue do for me?

Upvotes: 4

Views: 147

Answers (1)

user1329572
user1329572

Reputation: 6406

All you have to do is cast (int) c, where c is your char (i.e. character).

Upvotes: 8

Related Questions