Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by SharpDevelop.
- * User: savina.ivancheva
- * Date: 21.08.2017
- * Time: 14:03
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace SplitByWordCasing
- {
- class Program
- {
- public static void Main(string[] args)
- {
- var separators = new char[]{'.',',',':',';','(',')','[',']','\\','\"','\'','/','!','?',' '};
- var input = Console.ReadLine().Split( separators, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
- //var idName5 = Console.ReadLine().Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
- var upperCase = new List<string>();
- var lowerCase = new List<string>();
- var mixedCase = new List<string>();
- for (int i = 0; i < input.Count(); i++)
- {
- if (input[i].All(c => char.IsUpper(c)))
- {
- upperCase.Add(input[i]);
- }
- else if (input[i].All(c => char.IsLower(c)))
- {
- lowerCase.Add(input[i]);
- }
- else
- mixedCase.Add(input[i]);
- }
- //
- // Console.Write("Lower-case:" +" ");
- // for (int l = 0; l < lowerCase.Count; l++)
- // {
- // Console.Write(lowerCase[l] + ", ");
- // }
- // Console.WriteLine();
- //
- // Console.Write("Mixed-case:" +" ");
- // for (int j = 0; j < mixedCase.Count; j++)
- // {
- // Console.Write(mixedCase[j] + ", ");
- // }
- // Console.WriteLine();
- //
- // Console.Write("Upper-case:" +" ");
- // for (int k = 0; k < upperCase.Count; k++)
- // {
- // Console.Write(upperCase[k] + ", ");
- // }
- // Console.WriteLine();
- Console.WriteLine("Lower-case: " + string.Join(", "lowerCase()));
- Console.Write("Press any key to continue . . . ");
- Console.ReadKey(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment