How to convert text string to Integer

<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);
}>

i used this but it gives 0 on serial monitor

ToInt converts leading digits in a String to a number. You didn't give it any digits to work with.

What integer value do you think should be equal to "yasirali" ?

1. From Arduino Reference Manual--


Figure-1:

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

void setup()
{
  Serial.begin(9600);
  
  String myString = "1234";
  int z = myString.toInt();
  Serial.println(z, DEC); //shows: 1234
}

void loop()
{

}

I only want to convert alphabets to an integer variable

yasir_600:
I only want to convert alphabets to an integer variable

Some kind of hash function?

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.

...R