Añadida la funcion toLower()
This commit is contained in:
@@ -367,7 +367,6 @@ bool checkCollision(SDL_Point &p, d_line_t &l)
|
||||
|
||||
// En caso contrario, el punto está en la linea
|
||||
return true;
|
||||
|
||||
|
||||
/*const int m = (l.y2 - l.y1) / (l.x2 - l.x1);
|
||||
const int c = 0;
|
||||
@@ -575,4 +574,20 @@ std::string boolToString(bool value)
|
||||
{
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
|
||||
// Convierte una cadena a minusculas
|
||||
std::string toLower(std::string str)
|
||||
{
|
||||
char *original = str.c_str();
|
||||
char *lower = (char *)malloc(str.size() + 1);
|
||||
for (int i = 0; i < str.size(); ++i)
|
||||
{
|
||||
char c = original[i];
|
||||
lower[i] = (c >= 65 || c <= 90) ? c + 32 : c;
|
||||
}
|
||||
lower[str.size()] = 0;
|
||||
std::string nova(lower);
|
||||
free(lower);
|
||||
return nova;
|
||||
}
|
||||
@@ -200,4 +200,7 @@ bool stringToBool(std::string str);
|
||||
// Convierte un valor booleano en una cadena
|
||||
std::string boolToString(bool value);
|
||||
|
||||
// Convierte una cadena a minusculas
|
||||
std::string toLower(std::string str);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user