public void ShowOther(String input)
{
char [] holder = input.ToCharArray();
for (int i = 0; i < holder.Length; i++)
{
if (other.Contains(holder[i]))
{
holder.SetValue('^', i);
}
if (goodChars.Contains(holder[i]))
{
holder.SetValue(' ', i);
}
Console.Write(holder.GetValue(i));
}
}
So, right now I have this method as such. What I want to do is remove my printing from this method while maintaining the contents of the char[] holder.
Would changing return type to a char[] and then placing my return after the for loop work? Or am I off track and could do something simpler?
Yes, that would work.
I’m not sure how you’d use
GetOtherin a meaningful way without printing, so I don’t know if this refactoring is actually useful for you, but you’re probably a better judge of that than I am.