source: SMSSender/lib/libutils/src/strutils.cpp @ 41:680c6a482e9d

3.0
Last change on this file since 41:680c6a482e9d was 41:680c6a482e9d, checked in by Sämy Zehnder <saemy.zehnder@…>, 12 years ago
File size: 475 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
12bool StrUtils::isNumeric(const QString& s){
13    return isPositiveNumeric(s) || isNegativeNumeric(s);
14}
15
16bool StrUtils::isPositiveNumeric(const QString& s){
17    QString test(s);
18    return test.remove(QRegExp("^\\d+$")) == "";
19}
20
21bool 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.