Re: Functions for coversion strings to intergers


Andrew Fish
 

On Jul 21, 2021, at 10:01 AM, Konstantin Aladyshev <aladyshev22@gmail.com> wrote:

Are there any library functions that can convert a string with a
decimal number to a number, and tell if the conversion was successful?
What is your definition of successful?

I've found StrDecimalToUintnS and StrDecimalToUint64S functions in a
https://github.com/tianocore/edk2/blob/master/MdePkg/Library/BaseLib/SafeString.c
But it looks like they always return `RETURN_SUCCESS`, no matter if
the passed string contains a number. In this case the function simply
fills the number value with a 0.

Also why aren't there any functions for conversion of signed numbers?
Something like StrDecimalToIntnS/StrDecimalToInt64S ?
Most of the library functions evolved from code duplication in the firmware. Thus we only pick functions that commonly got used.

Thanks,

Andrew Fish

Best regards,
Konstantin Aladyshev


Join discuss@edk2.groups.io to automatically receive all group messages.