|
|
|
@ -577,7 +577,6 @@ uint32 fromHumanReadable (const std::string &str)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human readable time", "<int>")
|
|
|
|
|
{
|
|
|
|
|
nlunreferenced(rawCommandString);
|
|
|
|
@ -594,6 +593,50 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NLMISC_CATEGORISED_COMMAND(nel, toLower, "Convert a string to lowercase", "<string>")
|
|
|
|
|
{
|
|
|
|
|
nlunreferenced(args);
|
|
|
|
|
nlunreferenced(quiet);
|
|
|
|
|
nlunreferenced(human);
|
|
|
|
|
|
|
|
|
|
log.displayNL("%s", toLower(rawCommandString).c_str());
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NLMISC_CATEGORISED_COMMAND(nel, toUpper, "Convert a string to uppercase", "<string>")
|
|
|
|
|
{
|
|
|
|
|
nlunreferenced(args);
|
|
|
|
|
nlunreferenced(quiet);
|
|
|
|
|
nlunreferenced(human);
|
|
|
|
|
|
|
|
|
|
log.displayNL("%s", toUpper(rawCommandString).c_str());
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NLMISC_CATEGORISED_COMMAND(nel, toLowerAscii, "Convert a string's ascii-characters to lowercase", "<string>")
|
|
|
|
|
{
|
|
|
|
|
nlunreferenced(args);
|
|
|
|
|
nlunreferenced(quiet);
|
|
|
|
|
nlunreferenced(human);
|
|
|
|
|
|
|
|
|
|
log.displayNL("%s", toLowerAscii(rawCommandString).c_str());
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NLMISC_CATEGORISED_COMMAND(nel, toUpperAscii, "Convert a string's ascii-characters to uppercase", "<string>")
|
|
|
|
|
{
|
|
|
|
|
nlunreferenced(args);
|
|
|
|
|
nlunreferenced(quiet);
|
|
|
|
|
nlunreferenced(human);
|
|
|
|
|
|
|
|
|
|
log.displayNL("%s", toUpperAscii(rawCommandString).c_str());
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
|
|
std::string toLower(const char *str)
|
|
|
|
@ -739,6 +782,52 @@ void toUpperAscii(char *str, char replacement)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string toLowerAscii(const std::string &str)
|
|
|
|
|
{
|
|
|
|
|
std::string res;
|
|
|
|
|
res.reserve(str.size());
|
|
|
|
|
for (std::string::const_iterator it(str.begin()), end(str.end()); it != end; ++it)
|
|
|
|
|
{
|
|
|
|
|
char c = *it;
|
|
|
|
|
if (c >= 'A' && c <= 'Z') res += c + ('a' - 'A');
|
|
|
|
|
else res += c;
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void toLowerAscii(char *str)
|
|
|
|
|
{
|
|
|
|
|
for (ptrdiff_t i = 0; str[i]; ++i)
|
|
|
|
|
{
|
|
|
|
|
char c = str[i];
|
|
|
|
|
if (c >= 'A' && c <= 'Z') str[i] = c + ('a' - 'A');
|
|
|
|
|
else str[i] = c;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string toUpperAscii(const std::string &str)
|
|
|
|
|
{
|
|
|
|
|
std::string res;
|
|
|
|
|
res.reserve(str.size());
|
|
|
|
|
for (std::string::const_iterator it(str.begin()), end(str.end()); it != end; ++it)
|
|
|
|
|
{
|
|
|
|
|
char c = *it;
|
|
|
|
|
if (c >= 'a' && c <= 'z') res += c - ('a' - 'A');
|
|
|
|
|
else res += c;
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void toUpperAscii(char *str)
|
|
|
|
|
{
|
|
|
|
|
for (ptrdiff_t i = 0; str[i]; ++i)
|
|
|
|
|
{
|
|
|
|
|
char c = str[i];
|
|
|
|
|
if (c >= 'a' && c <= 'z') str[i] = c - ('a' - 'A');
|
|
|
|
|
else str[i] = c;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string toHexa(const uint8 &b)
|
|
|
|
|
{
|
|
|
|
|
return toString("%02hhx", b);
|
|
|
|
|