Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6.  
  7. namespace PFFinalExamRetake13December2019
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string skill = Console.ReadLine();
  14. string input = string.Empty;
  15. bool exist = false;
  16. while ((input = Console.ReadLine()) != "For Azeroth")
  17. {
  18. exist = false;
  19. string[] splittedInput = input.Split();
  20.  
  21. if (splittedInput.Contains("GladiatorStance"))
  22. {
  23. skill = skill.ToUpper();
  24. Console.WriteLine(skill);
  25. exist = true;
  26.  
  27. }
  28. else if (splittedInput.Contains("DefensiveStance"))
  29. {
  30. skill = skill.ToLower();
  31. Console.WriteLine(skill);
  32. exist = true;
  33.  
  34. }
  35. else if (splittedInput.Contains("Dispel"))
  36. {
  37. exist = true;
  38. int index = int.Parse(splittedInput[1]);
  39. char letter = char.Parse(splittedInput[2]);
  40. if (index > skill.Length - 1 || index < 0)
  41. {
  42. Console.WriteLine("Dispel too weak.");
  43.  
  44. }
  45. else
  46. {
  47. skill = skill.Remove(index, 1);
  48. skill = skill.Insert(index, letter.ToString());
  49. Console.WriteLine("Success!");
  50.  
  51. }
  52. }
  53. else if (splittedInput.Contains("Target"))
  54. {
  55. if (splittedInput[1] == "Change")
  56. {
  57. exist = true;
  58. string stringToBeChanged = splittedInput[2];
  59. string newString = splittedInput[3];
  60. skill = skill.Replace(stringToBeChanged, newString);
  61. Console.WriteLine(skill);
  62.  
  63. //int indexOf = skill.IndexOf(stringToBeChanged, 0);
  64. //int lenght = stringToBeChanged.Length;
  65. //if (indexOf != - 1)
  66. //{
  67. // skill = skill.Remove(indexOf, lenght);
  68. // skill = skill.Insert(indexOf, newString);
  69. // Console.WriteLine(skill);
  70. //}
  71. }
  72. else if (splittedInput[1] == "Remove")
  73. {
  74. exist = true;
  75. string stringToBeChanged = splittedInput[2];
  76. skill = skill.Replace(stringToBeChanged, string.Empty);
  77. Console.WriteLine(skill);
  78.  
  79. //int indexOf = skill.IndexOf(stringToBeChanged);
  80. //int lenght = stringToBeChanged.Length;
  81. //if (indexOf != - 1)
  82. //{
  83. // skill = skill.Remove(indexOf, lenght);
  84. // Console.WriteLine(skill);
  85. //}
  86.  
  87. }
  88. }
  89. if (exist == false)
  90. {
  91. Console.WriteLine("Command doesn't exist!");
  92. }
  93. }
  94. }
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement