Converting String to an Integer.

I have a project where I am reading serial data from a GPS unit. I am reading a number value into a String variable, how would I convert that string to an integer?

The String class has a toCharArray() method that copies the data to a char array. The result is exactly what atoi() needs as input.

http://arduiniana.org/libraries/tinygps/

From version IDE 22 the String Class has a toInt() operator returning a long.

so something like :

String s = "12345";
long x = s.toInt();

should work