mirror of
https://github.com/lifegpc/c-utils.git
synced 2026-06-06 13:18:57 +08:00
Add libiconv support
This commit is contained in:
15
str_util.cpp
Normal file
15
str_util.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "str_util.h"
|
||||
#include "cstr_util.h"
|
||||
#include <malloc.h>
|
||||
|
||||
bool str_util::tolowercase(std::string ori, std::string& result) {
|
||||
char* tmp = nullptr;
|
||||
auto re = cstr_tolowercase(ori.c_str(), ori.length(), &tmp);
|
||||
if (re) {
|
||||
result = std::string(tmp, ori.length());
|
||||
free(tmp);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user