From f9404d5cb7689925b5134e89835712c6b3400631 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Fri, 5 Jan 2007 22:14:24 +0000 Subject: - added function StringToInt --- tools.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools.cpp') 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; +} + } -- cgit v1.2.3