Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created March 10, 2018 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/8e715456c1f2ffc000f76c5c4e9b0329 to your computer and use it in GitHub Desktop.
Save parzibyte/8e715456c1f2ffc000f76c5c4e9b0329 to your computer and use it in GitHub Desktop.
boolean esCoordenadaValida(String coordenadas, int &x, int &y) {
int indice = coordenadas.indexOf(",");
if (indice != -1) {
String supuestoX = coordenadas.substring(0, indice),
supuestoY = coordenadas.substring(indice + 1, coordenadas.length() - 2);
if (isNumeric(supuestoX) && isNumeric(supuestoY)) {
x = supuestoX.toInt(), y = supuestoY.toInt();
return x >= 0 && y >= 0 && x < ANCHURA_LCD && y < ALTURA_LCD;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment