hob
aunknown
csharp
3 years ago
2.6 kB
1
Indexable
Never
using System; namespace templatealma { class Program { string InputText = ""; string InputPattern=""; void TakeText() { bool WrongInput = false; char[] UsableChars = { ' ','.', ',' ,'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; Console.WriteLine("Please enter the sentence"); InputText = Console.ReadLine(); Console.Clear(); for (int i = 0; i < InputText.Length; i++) { if (!(UsableChars.Contains(Convert.ToChar(InputText[i])))) { WrongInput = true; Console.WriteLine("Please just use English alphabet with ',' and '.'"); break; } } if(WrongInput) { TakeText(); } InputText.Split('.'); InputText.Split(' '); InputText.Split(','); } void TakePattern() { bool WrongPattern = false; char[] UsableChars = { '*', '-', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; Console.WriteLine("Please enter the pattern"); InputPattern = Console.ReadLine(); Console.Clear(); for (int i = 0; i < InputPattern.Length; i++) { if (!(UsableChars.Contains(Convert.ToChar(InputPattern[i])))) { WrongPattern = true; Console.WriteLine("Please just use English alphabet with '*' and '-'"); break; } } if (!WrongPattern) { Console.WriteLine(InputText); Console.WriteLine(InputPattern); } else { TakePattern(); } } void SeekingWords() { } static void Main(string[] args) { TakeText(); } } }