sivancheva

SplitByWordCasing

Aug 21st, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. /*
  2. * Created by SharpDevelop.
  3. * User: savina.ivancheva
  4. * Date: 21.08.2017
  5. * Time: 14:03
  6. *
  7. * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8. */
  9. using System;
  10. using System.Linq;
  11. using System.Collections.Generic;
  12.  
  13. namespace SplitByWordCasing
  14. {
  15. class Program
  16. {
  17. public static void Main(string[] args)
  18. {
  19. var separators = new char[]{'.',',',':',';','(',')','[',']','\\','\"','\'','/','!','?',' '};
  20.  
  21. var input = Console.ReadLine().Split( separators, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
  22.  
  23.  
  24. //var idName5 = Console.ReadLine().Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
  25.  
  26. var upperCase = new List<string>();
  27. var lowerCase = new List<string>();
  28. var mixedCase = new List<string>();
  29.  
  30.  
  31. for (int i = 0; i < input.Count(); i++)
  32. {
  33. if (input[i].All(c => char.IsUpper(c)))
  34. {
  35. upperCase.Add(input[i]);
  36. }
  37. else if (input[i].All(c => char.IsLower(c)))
  38. {
  39. lowerCase.Add(input[i]);
  40. }
  41.  
  42. else
  43.  
  44. mixedCase.Add(input[i]);
  45. }
  46.  
  47. //
  48. // Console.Write("Lower-case:" +" ");
  49. // for (int l = 0; l < lowerCase.Count; l++)
  50. // {
  51. // Console.Write(lowerCase[l] + ", ");
  52. // }
  53. // Console.WriteLine();
  54. //
  55. // Console.Write("Mixed-case:" +" ");
  56. // for (int j = 0; j < mixedCase.Count; j++)
  57. // {
  58. // Console.Write(mixedCase[j] + ", ");
  59. // }
  60. // Console.WriteLine();
  61. //
  62. // Console.Write("Upper-case:" +" ");
  63. // for (int k = 0; k < upperCase.Count; k++)
  64. // {
  65. // Console.Write(upperCase[k] + ", ");
  66. // }
  67. // Console.WriteLine();
  68.  
  69. Console.WriteLine("Lower-case: " + string.Join(", "lowerCase()));
  70.  
  71.  
  72. Console.Write("Press any key to continue . . . ");
  73. Console.ReadKey(true);
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment