<void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
String val = "yasirali";
int result = val.toInt();
Serial.println(result);
delay(1000);
}>
2. Description
The toInt() method extract a numerical value from a string of digits; where, the variable myString of Step-1 must be containing a string of digits from 0 to 9. 3. Example
yasir_600:
I only want to convert alphabets to an integer variable
Every alphabetic character is represented in the Arduino by a number - its ASCII value. For example 'A' is 65, 'B' is 66 and 'a' is 97
When you say "convert alphabets to an integer variable" do you mean that you want to get the character's ASCII code? If not then please explain, with an example, what do want to do. By "example" I mean that you should show us the alphabetic text and show us the corresponding integer value.