mouaip... ou tout simplement :
string weekOfYear = "200830";
int year;
int week;
bool formatOK = false;
if (!Int32.TryParse(weekOfYear.SubString(0,4), out year)) {
year = -1;
}
if (!Int32.TryParse(weekOfYear.SubString(4,2), out week)) {
week = -1;
}
if (week > 0 && week <= 53) { // certaines années ont 53 semaines !
formatOK = true;
}
...
Sébastien FERRAND (blog)
Consultant Sénior
[Microsoft Visual C# MVP]