ios - How to convert char(or Byte) with hexadecimal data in it, to an integer(decimal value) -
i have
char tem; its value shown blow:
printing description of tem: (char) tem = '\xd1' which should equals 209 in decimal.
my question how can implement conversion programmatically? want nsinteger equals 209 in case.
maybe there’s i’m overlooking here, given both char , nsinteger integral types, can’t do
char tem = '\xd1'; nsinteger = tem; ? or perhaps, avoid surprises sign extension,
nsinteger = tem & 0xff;
Comments
Post a Comment