English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I thought that basic mathematical operations would work, but it did not. I am thinking that if I could convert that character value to an integer and vice versa it would work to do the mathematic operation, but I am not certain if that is even possible. It would probably be in the string library I think?

2006-07-24 16:00:18 · 5 answers · asked by Bucky 2 in Computers & Internet Programming & Design

5 answers

You can take a character value (which is, after all, a numeric byte) and add or subtract from it. But it makes no sense to add one character to another. What is 'a' + 'b'? Nothing. But 'a' + 1 is 'b'.

2006-07-24 16:04:28 · answer #1 · answered by Larry 6 · 0 0

I supply this 10 hugs! ma wrote one the different day that spoke to me on an intuitive element. Deep as if linked I felt her poem. i comprehend this poem and want i'd have arise with the techniques you used to provide it- i respect the way you chosen the dictionary, calendar, properly meaning and destiny desire. i fairly do not imagine some human beings will ever experience the theory of deeper comprehend-how. This leaves me with remembering the grief that i'm really by myself because no longer some thing and no you possibly can at cases make it more effective. My spirituality is the purely porthole or perhaps then because i'm no longer ideal, I doubt. i comprehend i have "lengthy gone off" from the position this lead yet lol it fairly is me. BTW- Love the finest line so very a lot.

2016-11-25 22:24:19 · answer #2 · answered by Anonymous · 0 0

Yep, you need convert from ASCII to integer, do the math, then convert back. Sorry, forgot the function to perform that, but should be in docs.

2006-07-24 16:03:04 · answer #3 · answered by oldmoose2 4 · 0 0

Of course, it is possible to add/subtract ascii value of a char to change it's value. Take an example of a tolower(ch) function to convert uppercase char to a lowercase char. eg. 'B' to 'b'

#define isupper(ch) ( (ch) >= 'A' && (ch) <= 'Z' )
#define tolower(ch) ( isupper(ch) ? 'a' + (ch)-'A' : ch )

Note the operation to convert uppercase char to lowercase
'a' + (ch) - 'A'

Suppose the input char is 'B', the operation works out to be
'a' + 'B' - 'A'
= 'a' + 1
= 'b'

2006-07-24 16:52:07 · answer #4 · answered by swami060 3 · 0 0

It is the true math.
ASCII is a signed 8-bit integer, so 'A' + ' ' = 'a'.

2006-07-24 16:10:10 · answer #5 · answered by alakit013 5 · 0 0

fedest.com, questions and answers