There are different ways that data can be represented and each way has functions to handle the data. Here are ways to change a character ('0' - '9') to a number (0 - 9) and a string ("7") to a number (7).
int x; //this needs to be the integer value of str
char chr = '4'; // declare a char
char str = "7"; // declare one character string (+ 1 for the null terminator (2 bytes total))
x = chr - '0'; // to get the number (0-9) from a character subtract '0' or 48 (dec) or 0x30 (hex)
Serial.print("char chr converted to a number = ");
Serial.print("string str converted to a number = ");
Thank you for the help. I was trying to use string and could not make this work until I realised (super Noob) that the declaration should be String not string and i had my case wrong.
Once I did that then I was able to convert using toInt()