I'm making a hangman game in C#, and it needs to show the player the sentence, but with ALL characters as an "X", EXCEPT a space with a space. So if the sentence is "I'm a person" it would be "XXX X XXXXXX". I have found a way to do this when EVERY character replaces with "X", but the problem is that, spaces is also replaced with X.
The code:
string WrVS = String.Empty;
for (int i = 0; i < Words[randomVal].Length; i++)
{
WrVS += "X";
}
RWordCensored.Text = WrVS;
(randomVal is the random number that selects a random sentence from a list), (RWordCensored is a richTextBox that should show the sentence in the format I said.
I haven't found an answer on Google to my question.
/Viktor