checkFormat(string &s)
{
}
string s is a string that indicate the date.
I want to compare a string s, to find whether it is in terms of “yyyy:mm::dd” or not.
What should I do?
compare it char by char? What if the string is “600:12:01” ?
Sorry for my poor English.
Don’t use regex. Use
strptime(), which is designed to parse time strings (hence the name:str p time, string -> parse -> time). A regex can’t figure out that2013:2:29is invalid.