Convert String to long ?

Hi everybody,

I need help for my school project ?

Is it possible to convert a String to a long ?

I don't understant what I found on Google... :confused:

Thanks for help

We will help you if you try to answer the following questions.

1. What is a character?
2. What is the ASCII code of the character A?
3. What is the binary code of the hexadecimal digit A?
4. What is a string from programming point of view?
5. What is a String from programming point of view?
6. What is an array?
7. What is a NULL-byte?
8. How many bits make up a byte?
9. What is an int?
10. What is an unsigned int?
11. What is an unsigned long int?
12. What is an unsigned long?
13. What is an integer?

See the String reference for the toInt() function.

Perhaps strtol()

http://www.cplusplus.com/reference/cstdlib/strtol/

The op said String (capital S or String object).

The strtol() function works with strings (null terminated character arrays or C-strings).

So it depends on which type the OP is actually working with.

OP, FYI, Strings can cause memory fragmentation that causes weird errors if misused (see here). Null terminated character arrays (strings or C-strings) do not have those problems.

Ya, I was trying to steer OP away from Strings.