My idea would be: Use some sort of FieldChecker object that encapsulates the emptiness (or some other) check, and the action to be taken (sb.append()) etc, and loop over a list of such objects. This makes the code clearer since you have to explicitly define the outputs and inputs of that check.
–
millimooseMay 7 '13 at 11:41

This will reduce complexity from 28 down to 3. Always remember: high complexity counts are an indication that a method is trying to do too much. Complexity can be dealt with by dividing the problem into smaller pieces, like we did here.