Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created April 19, 2018 06:37
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 fitomad/c747388b45893e52b3091d26daf9cb90 to your computer and use it in GitHub Desktop.
Save fitomad/c747388b45893e52b3091d26daf9cb90 to your computer and use it in GitHub Desktop.
// Un String con texto
let modeloTelefono: String = "iPhone 6s"
// Un String vacio
let ubicacionDispositivo: String = ""
// ¿Y qué pasa con el espacio en blanco?
let espacioEnBlanco: String = " "
if modeloTelefono.isEmpty
{
print("No hay nada en la variable `modeloTelefono`")
}
if ubicacionDispositivo.isEmpty
{
print("No hay nada en la variable `ubicacionDispositivo`")
}
if !espacioEnBlanco.isEmpty
{
print("Los espacios en blanco sí son caracteres válidos y cuentan como tal")
}
/*
No hay nada en la variable `ubicacionDispositivo`
Los espacios en blanco SÍ son caracteres válidos y cuentan como tal
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment