diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/NormalizeCaseInsensitiveString.cpp | 24 | ||||
-rw-r--r-- | src/NormalizeCaseInsensitiveString.hpp | 30 |
2 files changed, 54 insertions, 0 deletions
diff --git a/src/NormalizeCaseInsensitiveString.cpp b/src/NormalizeCaseInsensitiveString.cpp new file mode 100644 index 0000000..761c72a --- /dev/null +++ b/src/NormalizeCaseInsensitiveString.cpp @@ -0,0 +1,24 @@ +/** + * @file NormalizeCaseInsensitiveString.cpp + * + * This module contains the implementation of the + * Uri::NormalizeCaseInsensitiveString function. + * + * © 2018 by Richard Walters + */ + +#include "NormalizeCaseInsensitiveString.hpp" + +#include <ctype.h> + +namespace Uri { + + std::string NormalizeCaseInsensitiveString(const std::string& inString) { + std::string outString; + for (char c: inString) { + outString.push_back(tolower(c)); + } + return outString; + } + +} diff --git a/src/NormalizeCaseInsensitiveString.hpp b/src/NormalizeCaseInsensitiveString.hpp new file mode 100644 index 0000000..014dd74 --- /dev/null +++ b/src/NormalizeCaseInsensitiveString.hpp @@ -0,0 +1,30 @@ +#ifndef URI_NORMALIZE_CASE_INSENSITIVE_STRING_HPP +#define URI_NORMALIZE_CASE_INSENSITIVE_STRING_HPP + +/** + * @file NormalizeCaseInsensitiveString.hpp + * + * This module declares the Uri::NormalizeCaseInsensitiveString function. + * + * © 2018 by Richard Walters + */ + +#include <string> + +namespace Uri { + + /** + * This function takes a string and swaps all upper-case characters + * with their lower-case equivalents, returning the result. + * + * @param[in] inString + * This is the string to be normalized. + * + * @return + * The normalized string is returned. All upper-case characters + * are replaced with their lower-case equivalents. + */ + std::string NormalizeCaseInsensitiveString(const std::string& inString); +} + +#endif /* URI_NORMALIZE_CASE_INSENSITIVE_STRING_HPP */ |