diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/string.cpp | 12 | ||||
-rw-r--r-- | src/utils/string.hpp | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/utils/string.cpp b/src/utils/string.cpp index 04d5f031..0785429d 100644 --- a/src/utils/string.cpp +++ b/src/utils/string.cpp @@ -18,14 +18,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include <string> -#include <cctype> + #include "utils/string.hpp" +#include <cctype> +#include <algorithm> + std::string utils::toupper(std::string s) { - for (int j=0; j<s.length(); ++j) - s[j]=std::toupper(s[j]); + std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper); return s; -} - +} diff --git a/src/utils/string.hpp b/src/utils/string.hpp index 6561b9e4..ea70e72a 100644 --- a/src/utils/string.hpp +++ b/src/utils/string.hpp @@ -18,6 +18,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ + #ifndef UTILS_STRING_HPP #define UTILS_STRING_HPP @@ -28,4 +29,4 @@ namespace utils std::string toupper(std::string); } -#endif +#endif // UTILS_STRING_HPP |