Question: 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\">&nbsp;</td>");
        mo++;
    } else {
        sb.Append("<td>&nbsp;</td>");
    }

    if (breakfastDays.Contains("2")) {
        sb.Append("<td class=\"active\">&nbsp;</td>");
        tu++;
    } else {
        sb.Append("<td>&nbsp;</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?

Answer: 
Yes, you can use a loop. The only tricky thing is the variables that you increase, it would be easier if you used an array for that.

```
for (char c = '1'; c <= '7'; c++) {
  if (breakfastDays.Contains(c)) {
    sb.Append("<td class=\"active\">&nbsp;</td>");
    switch (c) {
      case '1': mo++; break;
      case '2': tu++; break;
      case '3': we++; break;
      case '4': th++; break;
      case '5': fr++; break;
      case '6': sa++; break;
      case '7': su++; break;
    }
  } else {
    sb.Append("<td>&nbsp;</td>");
  }
} 

```
This will fix the issue of having to write seven tests for the table:

```
for (int i = 1; i <= 7; i++)
{
    if (breakfastDays.Contains(i.ToString())
    {
        sb.Append("<td class=\"active\">&nbsp;</td>"));
    }
    else
    {
        sb.Append("<td>&nbsp;</td>");
    }
}

```

We could sure get more clever but I don't want to skip over the importance of `mo++` and `tu++` in your code.