[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03821] Re: How to validate data?

From: matz@... (Yukihiro Matsumoto)
Date: 2000-07-05 09:46:40 UTC
List: ruby-talk #3821
In message "[ruby-talk:03818] How to validate data?"
    on 00/07/05, Jilani Khaldi <jilanik@tin.it> writes:
|I have a string containing a date, for example: myDate = "12/10/2000"
|Does Ruby have something comand like this: is_date(myDate) .. ?

def validdate?(date)
  if %r{\d\d/\d\d/\d\d\d\d} =~ date
    true
  else
    false
  end
end

myDate = "12/10/2000"
print validdate?(myDate), "\n"

In This Thread

Prev Next