Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string ValidateInput(string title, string description)
- {
- while (true)
- {
- Console.WriteLine("Please enter a title:");
- try
- {
- title = ValidateString(Console.ReadLine().ToString());
- }
- catch (Exception) //ex???
- {
- Console.WriteLine("Failed to parse title parameter.");
- }
- if (title.Length < 10 || title.Length > 50)
- {
- Console.WriteLine("Title should be a string between 10 and 50 symbols.");
- continue;
- }
- else
- {
- break;
- }
- }
- while (true)
- {
- Console.WriteLine("Please enter a description:");
- try
- {
- description = ValidateString(Console.ReadLine().ToString());
- }
- catch (Exception) //ex???
- {
- Console.WriteLine("Failed to parse description parameter.");
- }
- if (description.Length < 10 || description.Length > 500)
- {
- Console.WriteLine("Description should be a string between 10 and 500 symbols.");
- continue;
- }
- else
- {
- break;
- }
- }
- return "";
- }
Advertisement
Add Comment
Please, Sign In to add comment