How do you test if a string is valid in date format?
Utilisateur anonyme
Suppose the date format is like yyyy-mm-dd. Then write following test code to judge if the condition is satisfied. 1. Test if the length of this string is correct. 2. Test if first 4 characters are numbers. 3. Test if month is correct. 4. Test if date is correct. If any of the above fails, return false. If all pass, return true.