mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Added toLower/UpperUnsafe.
This commit is contained in:
@@ -60,31 +60,39 @@ namespace bx
|
||||
return _ch + (isUpper(_ch) ? 0x20 : 0);
|
||||
}
|
||||
|
||||
void toLower(char* _inOutStr, size_t _max)
|
||||
void toLowerUnsafe(char* _inOutStr, size_t _len)
|
||||
{
|
||||
size_t len = strnlen(_inOutStr, _max);
|
||||
|
||||
for (size_t ii = 0; ii < len; ++ii)
|
||||
for (size_t ii = 0; ii < _len; ++ii)
|
||||
{
|
||||
*_inOutStr = toLower(*_inOutStr);
|
||||
}
|
||||
}
|
||||
|
||||
void toLower(char* _inOutStr, size_t _max)
|
||||
{
|
||||
const size_t len = strnlen(_inOutStr, _max);
|
||||
toLowerUnsafe(_inOutStr, len);
|
||||
}
|
||||
|
||||
char toUpper(char _ch)
|
||||
{
|
||||
return _ch - (isLower(_ch) ? 0x20 : 0);
|
||||
}
|
||||
|
||||
void toUpper(char* _inOutStr, size_t _max)
|
||||
void toUpperUnsafe(char* _inOutStr, size_t _len)
|
||||
{
|
||||
size_t len = strnlen(_inOutStr, _max);
|
||||
|
||||
for (size_t ii = 0; ii < len; ++ii)
|
||||
for (size_t ii = 0; ii < _len; ++ii)
|
||||
{
|
||||
*_inOutStr = toUpper(*_inOutStr);
|
||||
}
|
||||
}
|
||||
|
||||
void toUpper(char* _inOutStr, size_t _max)
|
||||
{
|
||||
const size_t len = strnlen(_inOutStr, _max);
|
||||
toUpperUnsafe(_inOutStr, len);
|
||||
}
|
||||
|
||||
bool toBool(const char* _str)
|
||||
{
|
||||
char ch = toLower(_str[0]);
|
||||
|
||||
Reference in New Issue
Block a user