Converting a single String character to representative int. How? Javascript

Say I have the letter "A" in a string variable.

And I want to perform "addition" upon it, so that it becomes "B", then "C", and then later I want to go backwards, from "C" to "B", and "B" to "C".

I've seen somewhere that this can be represented numerically, by a number between 0 and 255, but don't know what this numerical representation of the alphabet is called. Or how to change the string to this format for addition, and then back to a string for printing.

The question, how do I turn that variable string of the letter "A" into that representative number, add 1 to that number, and then pass it back to the string variable as the new number, thereby increasing the "A" to "B".

Or is there are a better way to do this?

It sounds like you want the hexadecimal equivalent of "A". Hexadecimal is base-16, and uses the digits 0-9 then A-F.

Here's an example of converting hex and back in C#.

Edit, on re-reading, I'm thinking you might just want the character code version of "A". In that case, you can just do:

string str = "A";
char c = str[0];
Debug.Log( c );  // prints A
Debug.Log( c );  // prints B

Edit, added JS:

var str : String = "A";
var c : int = str[0];
Debug.Log( System.Convert.ToChar( c ) );  // prints A
Debug.Log( System.Convert.ToChar( c ) );  // prints B

The integer value of a character is referred to as its ASCII value.

A is 65, B is 66, C is 67, etc...

I'm not sure if everything is the same in unicode.

var stringValue : String = "A";

/* get the int value of the first character in the string */

var intValue : int = stringValue[0];


intValue ++;

var stringFromAscii : String = System.Convert.ToChar(intValue);