Okay, so I have a <tr> table being built from a string that looks something like this: 13467
1= monday
2= tuesday
...
7= sunday
so 13467 = mon,wed,thurs,sat,sun
My existing code manually checked the string, like so
if (breakfastDays.Contains("1")) {
sb.Append("<td class=\"active\"> </td>");
mo++;
} else {
sb.Append("<td> </td>");
}
if (breakfastDays.Contains("2")) {
sb.Append("<td class=\"active\"> </td>");
tu++;
} else {
sb.Append("<td> </td>");
}
The class="active"part just tells the css to check the box.
Is there an easier way of doing the string checking by any chance?
Perhaps some for-in loops maybe?
moandtuin this code.