PDA

View Full Version : Get ASCII decimal value of current character



RayJ
December 26th, 2015, 07:48 PM
I can look up characters in ASCII tables or even convert the view of the file to hex or octal, etc. But I can't find a simple way to get the decimal ASCII value of the current character into a numeric variable.

I want something like:

#10 = num_eval_char(decimal)

It seems like it should be easy, but I don't see any commands that do this. And I don't want to have to do a complex if/then/else structure.

So, is there any easy way?

Scott Lambert
December 27th, 2015, 10:45 AM
Hi Rayj,

The command you are looking for is cur_char

So you could have #10=cur_char

It also takes a parameter, say you want to test a character two file positions forward from current position, you would have cur_char(2). Back would be cur_char(-2)

Scott

RayJ
March 7th, 2016, 07:05 PM
I see that cur_char does the trick. Thanks.

But the user's manual (vplus60.pdf) that I used didn't help. I searched for 'ASCII', figuring that would eventually take me to the place I wanted. But the only thing listed in the cur_char paragraph is the word 'value'. That wasn't enough for me to find. Please add the word ASCII into the manual to make it easier in the future (at least for someone with the newer manual).