Home > Back-end >  character parsing for new variable
character parsing for new variable

Time:10-07

So I got the character with the value: ( '2'; 0x32 ) excluding the brackets and I'd like the give another variable the value between the ' ', in this case, the 2.

Let's say char j='2'; 0x32 ; int i ; I've tried: i=j[1];

To take the second variable (2) withing the character j, but it doesn't seem to work. Any help would be much appreciated!

CodePudding user response:

It depends on how you got this value, because in the ASCII / Unicode table, 0x32 (or 50 in decimal) and character 2 are the same.

Perhaps you have errors in how you get this value. If not, then int i = j; will help.

  • Related