| 5018 | } |
| 5019 | |
| 5020 | bool String::is_valid_hex_number(bool p_with_prefix) const { |
| 5021 | int len = length(); |
| 5022 | |
| 5023 | if (len == 0) { |
| 5024 | return false; |
| 5025 | } |
| 5026 | |
| 5027 | int from = 0; |
| 5028 | if (len != 1 && (operator[](0) == '+' || operator[](0) == '-')) { |
| 5029 | from++; |
| 5030 | } |
| 5031 | |
| 5032 | if (p_with_prefix) { |
| 5033 | if (len < 3) { |
| 5034 | return false; |
| 5035 | } |
| 5036 | if (operator[](from) != '0' || operator[](from + 1) != 'x') { |
| 5037 | return false; |
| 5038 | } |
| 5039 | from += 2; |
| 5040 | } |
| 5041 | |
| 5042 | if (from == len) { |
| 5043 | return false; |
| 5044 | } |
| 5045 | |
| 5046 | for (int i = from; i < len; i++) { |
| 5047 | char32_t c = operator[](i); |
| 5048 | if (is_hex_digit(c)) { |
| 5049 | continue; |
| 5050 | } |
| 5051 | return false; |
| 5052 | } |
| 5053 | |
| 5054 | return true; |
| 5055 | } |
| 5056 | |
| 5057 | bool String::is_valid_float() const { |
| 5058 | int len = length(); |
no test coverage detected