问题
Do you know any functions that would preform the same as ord
and chr
from Python in Java.
Python docs on them.
- http://docs.python.org/2/library/functions.html#ord
- http://docs.python.org/2/library/functions.html#chr
I've experienced manually but seem to get so many errors. This would need to work with Strings
not just char
. Figured I would see if there was a function to do it pre-built.
Thanks
回答1:
You can cast:
c = (char) n;
n = (int) c;
来源:https://stackoverflow.com/questions/20250048/methods-like-ord-and-chr-from-python