3.0
Last change
on this file since 71:415b45c71663 was
71:415b45c71663,
checked in by Sämy Zehnder <saemy.zehnder@…>, 12 years ago
|
- Reorganized all the libraries. libinterfaces and libgateways are removed now and libdatatypes contains now all these files.
|
File size:
470 bytes
|
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 | bool ok; |
---|
18 | int val = s.toInt(&ok); |
---|
19 | return ok && val >= 0; |
---|
20 | } |
---|
21 | |
---|
22 | bool StrUtils::isNegativeNumeric(const QString& s){ |
---|
23 | bool ok; |
---|
24 | int val = s.toInt(&ok); |
---|
25 | return ok && val <= 0; |
---|
26 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.