Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using EasterRaces.Core.Contracts;
- using EasterRaces.IO;
- using EasterRaces.IO.Contracts;
- using EasterRaces.Core.Entities;
- using System;
- namespace EasterRaces
- {
- public class StartUp
- {
- public static void Main()
- {
- //IChampionshipController controller = null; //new ChampionshipController();
- //IReader reader = new ConsoleReader();
- //IWriter writer = new ConsoleWriter();
- enigne = new Engine(controller, reader, writer);
- //enigne.Run();
- //Engine
- string text = Console.ReadLine();
- while (true)
- {
- string line = Console.ReadLine();
- if (line == "Done")
- {
- break;
- }
- string[] parts = line.Split(" ", StringSplitOptions.RemoveEmptyEntries);
- string command = parts[0];
- if (command == "Change")
- {
- string letter = parts[1];
- string replacement = parts[2];
- text = text.Replace(letter, replacement);
- }
- else if (command == "Uppercase")
- {
- text = text.ToUpper();
- Console.WriteLine(text);
- }
- else if (command == "Includes")
- {
- string newString = parts[1];
- if (text.Contains(newString))
- {
- Console.WriteLine("True");
- }
- else
- {
- Console.WriteLine("False");
- }
- }
- else if (command == "End")
- {
- string endString = parts[1];
- if (text.EndsWith(endString))
- {
- Console.WriteLine("True");
- }
- else
- {
- Console.WriteLine("False");
- }
- }
- else if (command == "FindIndex")
- {
- int index = text.IndexOf(parts[1]);
- Console.WriteLine(index);
- }
- else if (command == "Cut")
- {
- int startIdx = int.Parse(parts[1]);
- int lenght = int.Parse(parts[2]);
- text = text.Substring(startIdx, lenght);
- Console.WriteLine(text);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment