fixes required by review of pr1700

This commit is contained in:
csoler 2019-11-25 22:16:32 +01:00
parent 5223ff751a
commit 7aa51423a4
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
13 changed files with 98 additions and 154 deletions

View file

@ -205,6 +205,19 @@ bool ConvertUtf16ToUtf8(const std::wstring& source, std::string& dest)
return true;
}
bool is_alphanumeric(char c)
{
return (c>='0' && c<'9') || (c>='a' && c<='z') || (c>='A' && c<='Z') ;
}
bool is_alphanumeric(const std::string& s)
{
for(uint32_t i=0;i<s.size();++i)
if(!is_alphanumeric(s[i]))
return false;
return true;
}
} } // librs::util
#ifdef WINDOWS_SYS

View file

@ -25,10 +25,14 @@
#include <string>
#include <stdarg.h>
namespace librs { namespace util {
namespace librs {
namespace util {
bool ConvertUtf8ToUtf16(const std::string& source, std::wstring& dest);
bool ConvertUtf16ToUtf8(const std::wstring& source, std::string& dest);
bool ConvertUtf8ToUtf16(const std::string& source, std::wstring& dest);
bool ConvertUtf16ToUtf8(const std::wstring& source, std::string& dest);
bool is_alphanumeric(char c) ;
bool is_alphanumeric(const std::string& s);
} } // librs::util