0

c#

int a =0; string name=textBox1.Text.Trim(); char[] ch= name.ToCharArray(); a=ch.Length; for(int i =ch.Length-1; i>=0;i--) { if(a %2 ==0) { richTextBox1.Text += ch[i].ToString(); richTextBox1.ForeColor= Color.Red; } else { richTextBox1.Text += ch[i].ToString(); richTextBox1.ForeColor= Color.Black; } But when i put Letter like this "book" it is go to( first condition) but "Bo ok" it is not go to (first condition ) why like this ? I want to cut space.

18th Jul 2017, 2:33 PM
lee ratana
3 Answers
+ 2
string.replace(" ",""); The first " " is to search for all the spaces in a string and the second "" is to replace it with nothing.
18th Jul 2017, 2:37 PM
Limitless
Limitless - avatar
0
Can you give Example please sir?
18th Jul 2017, 2:40 PM
lee ratana
18th Jul 2017, 6:35 PM
Limitless
Limitless - avatar