How to parse URL values as numbers, not strings

Hello, I am using the ethernet shield on an Arduino 328. Using the standard example that comes with it I have managed to get my code to control my Arduino from a webpage. I do this by parsing the URL that is returned, but by parsing, I end up with a set of strings. What I need is a value that I can do something with.

Say my URL is “”

I am currently parsing this with:


int first = inString.indexOf('m');
int second = inString.indexOf('H');
Serial.print("Setting rate to ");

for (int i = (first + 2); i <= (second - 1); i++){

This does a nice job of retrieving the correct rate (120 in this case) but what I need to do is use that number. It isn’t a number at this point, it is a string.

Does anyone have an idea of how I can either retrieve this value as a number or convert it from a string into a number?




The atoi function converts a string to an integer. There are equivalent (atof, atol, etc.) functions for converting strings to other types (float, long, etc.).