mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-25 16:42:39 -06:00
added helper functions for upper/lowercase strings
This commit is contained in:
parent
18766b9e69
commit
cb504e236b
2 changed files with 22 additions and 0 deletions
|
@ -17,6 +17,22 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// Make a string lowercase
|
||||||
|
void LowerStr(char* str) {
|
||||||
|
for (int i = 0; str[i]; i++) {
|
||||||
|
str[i] = tolower(str[ i ]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Make a string uppercase
|
||||||
|
void UpperStr(char* str) {
|
||||||
|
for (int i=0; i < strlen(str); i++) {
|
||||||
|
if(str[i] >= 'a' && str[i] <= 'z') {
|
||||||
|
str[i] &= 0xDF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// faster than sscanf
|
// faster than sscanf
|
||||||
bool AsciiToHex(const char* _szValue, u32& result)
|
bool AsciiToHex(const char* _szValue, u32& result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,12 @@
|
||||||
|
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
|
|
||||||
|
/// Make a string lowercase
|
||||||
|
void LowerStr(char* str);
|
||||||
|
|
||||||
|
/// Make a string uppercase
|
||||||
|
void UpperStr(char* str);
|
||||||
|
|
||||||
std::string StringFromFormat(const char* format, ...);
|
std::string StringFromFormat(const char* format, ...);
|
||||||
// Cheap!
|
// Cheap!
|
||||||
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
|
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
|
||||||
|
|
Loading…
Reference in a new issue