This indicates the factoring is wrong. Why iterate an array of a single character? There should be a function to test a single character that you can use directly here. Then that function should be used by both the range-iterating thing and the per-character iterating thing.