Add wcstolower

Converts a string to lowercase. Eliminates some loops that did this
explicitly.
This commit is contained in:
ridiculousfish
2019-07-06 12:19:34 -07:00
parent b1a1b617f1
commit bc0329f775
5 changed files with 16 additions and 23 deletions

View File

@@ -4,6 +4,8 @@
#include "common.h"
#include "wcstringutil.h"
#include <wctype.h>
typedef wcstring::size_type size_type;
wcstring_range wcstring_tok(wcstring &str, const wcstring &needle, wcstring_range last) {
@@ -59,3 +61,9 @@ wcstring trim(const wcstring &input, const wchar_t *any_of) {
wcstring result(input.begin() + begin_offset, end + 1);
return result;
}
wcstring wcstolower(wcstring input) {
wcstring result = std::move(input);
std::transform(result.begin(), result.end(), result.begin(), towlower);
return result;
}