3.0
Line | |
---|
1 | /* |
---|
2 | * strutils.cpp |
---|
3 | * |
---|
4 | * Created on: Jun 19, 2009 |
---|
5 | * Author: saemy |
---|
6 | */ |
---|
7 | |
---|
8 | #include "strutils.h" |
---|
9 | |
---|
10 | #include <QRegExp> |
---|
11 | |
---|
12 | bool StrUtils::isNumeric(const QString& s){ |
---|
13 | return isPositiveNumeric(s) || isNegativeNumeric(s); |
---|
14 | } |
---|
15 | |
---|
16 | bool StrUtils::isPositiveNumeric(const QString& s){ |
---|
17 | QString test(s); |
---|
18 | return test.remove(QRegExp("^\\d+$")) == ""; |
---|
19 | } |
---|
20 | |
---|
21 | bool StrUtils::isNegativeNumeric(const QString& s){ |
---|
22 | QString test(s); |
---|
23 | return test.remove(QRegExp("^-\\d+$")) == ""; |
---|
24 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.