MCPcopy Create free account
hub / github.com/MyGUI/mygui / check_string_to_number_format

Function check_string_to_number_format

Tools/EditorFramework/pugixml.cpp:7104–7139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7102}
7103
7104PUGI__FN bool check_string_to_number_format(const char_t* string)
7105{
7106 // parse leading whitespace
7107 while (PUGI__IS_CHARTYPE(*string, ct_space))
7108 ++string;
7109
7110 // parse sign
7111 if (*string == '-')
7112 ++string;
7113
7114 if (!*string)
7115 return false;
7116
7117 // if there is no integer part, there should be a decimal part with at least one digit
7118 if (!PUGI__IS_CHARTYPEX(string[0], ctx_digit) && (string[0] != '.' || !PUGI__IS_CHARTYPEX(string[1], ctx_digit)))
7119 return false;
7120
7121 // parse integer part
7122 while (PUGI__IS_CHARTYPEX(*string, ctx_digit))
7123 ++string;
7124
7125 // parse decimal part
7126 if (*string == '.')
7127 {
7128 ++string;
7129
7130 while (PUGI__IS_CHARTYPEX(*string, ctx_digit))
7131 ++string;
7132 }
7133
7134 // parse trailing whitespace
7135 while (PUGI__IS_CHARTYPE(*string, ct_space))
7136 ++string;
7137
7138 return *string == 0;
7139}
7140
7141PUGI__FN double convert_string_to_number(const char_t* string)
7142{

Callers 1

convert_string_to_numberFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected