String to Float

Hi Community

Does anybody have an Idea how i can convert a String of the Format: "4.341700E-2" to the correct Float Number 0.04341700?

Note: the String has everytime the same length. It's not foreseen that the Exponent is two decimals long...


Is it a String or or a string ?

it's a String

1> you need to convert String into character array. for this you can use toCharArray().
2> then use atof() to convert char array to float.

Is it a String or or a string ?

what's the difference?

String (capital S) is a C++ class for manipulating string data. It brings a lot of functionality to the table, but at the cost of a huge memory penalty. My experience is that it adds about 2K to the program size. On the other hand, "pure" C uses string (small s) data built from char arrays. These strings expect the string to be terminated with the null character ('\0'). I think most people here use string data rather than String data.

I Googled "String versus string" and got 52 million hits, so one of those should give you a pretty good idea of operational difference.