diff options
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index a25665e4a88c..5a41c098654e 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -616,3 +616,11 @@ bool statusOk(int status) { return WIFEXITED(status) && WEXITSTATUS(status) == 0; } + + +bool string2Int(const string & s, int & n) +{ + istringstream str(s); + str >> n; + return str && str.eof(); +} |