summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools.cpp b/tools.cpp
index 6531cd8..e135c0b 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -49,4 +49,13 @@ vector< string > StringSplit( string const& text, char delimiter )
return result;
}
+int StringToInt( std::string const& string, int base )
+{
+ char* end;
+ int result = strtol( string.c_str(), &end, base );
+ if ( *end == '\0' )
+ return result;
+ return 0;
+}
+
}