String number parsing error handling


#1

Hi Jules,

 

Would it be possible to add at some point a way to know if String to number conversion succeeded ?

Currently using getIntValue(), getLargeIntValue(), getFloatValue(), getDoubleValue(), there is no way to know if the returned number is valid.

An optional bool pointer passed as an argument could do the trick and wouldn't break the current code

 

Something like that:

 

String str("toto");

bool res;

int value = str.getIntValue(&res);

 

Thanks !

 

 

 


#2

TBH what I'd like to do is to add a new class whose duty is just to do all the different string<->number conversions, and that'd be the place for this kind of thing. In the meantime I don't really want to bloat the string class with any more methods, or to burden those existing methods with a defaulted parameter that will almost never be used.