skip to main | skip to sidebar

Pildoras computinas

martes, 26 de noviembre de 2013

Test if string is a number in Ruby

def is_number?(object)
  true if Float(object) rescue false
end

(http://stackoverflow.com/questions/5661466/test-if-string-is-a-number-in-ruby-on-rails)

Publicado por pbustos en 14:50

No hay comentarios:

Publicar un comentario

Entrada más reciente Entrada antigua Inicio
Suscribirse a: Enviar comentarios (Atom)

Archivo del blog

  • ►  2023 (1)
    • ►  marzo (1)
  • ►  2020 (1)
    • ►  abril (1)
  • ►  2019 (1)
    • ►  diciembre (1)
  • ►  2015 (1)
    • ►  enero (1)
  • ►  2014 (2)
    • ►  noviembre (1)
    • ►  junio (1)
  • ▼  2013 (8)
    • ►  diciembre (1)
    • ▼  noviembre (1)
      • Test if string is a number in Ruby
    • ►  agosto (2)
    • ►  julio (1)
    • ►  junio (1)
    • ►  mayo (1)
    • ►  enero (1)
  • ►  2012 (3)
    • ►  mayo (1)
    • ►  abril (2)
  • ►  2011 (8)
    • ►  junio (1)
    • ►  mayo (1)
    • ►  marzo (2)
    • ►  febrero (2)
    • ►  enero (2)
  • ►  2010 (28)
    • ►  septiembre (2)
    • ►  agosto (2)
    • ►  julio (5)
    • ►  junio (3)
    • ►  mayo (4)
    • ►  abril (4)
    • ►  marzo (3)
    • ►  febrero (2)
    • ►  enero (3)
  • ►  2009 (39)
    • ►  diciembre (2)
    • ►  octubre (2)
    • ►  septiembre (4)
    • ►  agosto (4)
    • ►  julio (3)
    • ►  junio (2)
    • ►  mayo (2)
    • ►  marzo (8)
    • ►  febrero (1)
    • ►  enero (11)
  • ►  2008 (56)
    • ►  diciembre (2)
    • ►  noviembre (10)
    • ►  octubre (14)
    • ►  septiembre (30)

Datos personales

pbustos
Ver todo mi perfil