Changed startsWithDouble to startsWithNumber.

This commit is contained in:
Brad Arant 2024-09-26 12:32:04 -07:00
parent 974a509767
commit e2d20a0c2d
3 changed files with 4 additions and 9 deletions

View File

@ -322,13 +322,8 @@ namespace coreutils {
return strncmp(cursor, value, strlen(value)) == 0;
}
bool ZString::startsWithDouble() {
push();
char *tempc = cursor;
double temp = strtod(cursor, &cursor);
int diff = cursor - tempc;
pop();
return diff != 0;
bool ZString::startsWithNumber() {
return ((*cursor >= '0') && (*cursor <= '9'));
}
int ZString::compare(ZString zstring) {

View File

@ -252,7 +252,7 @@ namespace coreutils {
///
///
bool startsWithDouble();
bool startsWithNumber();
///
///

View File

@ -100,7 +100,7 @@ int main(int argc, char **argv) {
test18.reset();
std::cout << "[" << test18.find("x") << "] " << test18.parsed() << ":" << test18.unparsed() << std::endl;
coreutils::ZString test19("-16473.65476Z");
coreutils::ZString test19("1,");
std::cout << test19.asDouble() << ":" << test19.unparsed() << std::endl;
}