Convert a String to its ASCII DECIMAL VALUE?

Hi.. I need to convert a String value to its ASCII decimal value.

Does anybody know if there is an simple function or If I will need to do a lot of replaces?

String myvar ="a"

I wanted to receive the 97 (because 97 is decimal value of "a")

Any sugestion will be welcome :slight_smile:

Tks

I need to convert a String value to its ASCII decimal value.

A String doesn't have an ASCII value, only individual characters, so just treat the constituent characters as "into"s, and you've done what you want.

char x = 'a';

void setup() 
{
  Serial.begin(115200);
  Serial.println((int) x);
}

void loop() 
{
}

Perfect!!

What If I want to get (in my case) the Decimal 116 that represents 'r'.

How Could I "decode" the 116 and retrieve the 'r'?

Store 116 in a char variable.

tks I'll keep reading here.

regards