Code:using System; class stringtest2 { static void Main() { Console.Write("Enter something ? "); String line = Console.In.ReadLine(); String list = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; String finalstring = ""; int i = 0; while (line != ".") { foreach (char a in line) { if (list.IndexOf(a) != -1) { finalstring += a.ToString(); } } line = "."; Console.WriteLine("\n{0}", finalstring); i++; line = Console.In.ReadLine(); } } }
Hi, thats the code, i won't lie, i was able to get it with the precious help from some generous members of the forums ive been in (including this one). I modified it a little bit. The code work well almost like i need.
When you enter a bunch of characters, it only shows up the letters and if you add more letters, it add them to the screen. Exactly what i want. When you enter a period, it exit the loop. Thats the main goal of this code but what i'm trying to do is the period sentinal in the text you type. In other words, the loop would only exit if in the bunch of characters you enter, theres a period. In this code, it only exist the loop if you enter the perdiod alone.
Right now, thats what it does:
#@$#@a@#$23432b#$#@$@#c.
abc
.
Press any key to continue . . .
Thats what i'm trying to do:
#@$#@a@#$23432b#$#@$@#c.
abc
Press any key to continue . . .
Is it possible to make this. Ive spend hours on it but i cant find a solution.