Im trying to replace every 2nd character of user entered text to a underscore. I have iterated through a character array but when I try to change a specific character using an index it says "Cannot implicitly convert type 'String' to 'Char'.
What am I doing wrong here? Thanks.
Char[] secondChar = enteredString.ToCharArray();
for (int i = 1; i < secondChar.Length; i += 2)
{
secondChar[i] = "_";
}
Console.WriteLine(secondChar);
"_"is a string.'_'is a char.var replaced = string.Join("",enteredString.Select( (ch,idx) => idx%2==1 ? '_': ch));