Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace String_Manipulator___Group_1_03.August._2019
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string command = "";
- while ((command = Console.ReadLine()) != "End")
- {
- string[] splittedC = command.Split(" ");
- string newCom = splittedC[0];
- if (newCom == "Translate")
- {
- string oldChar = splittedC[1];
- string newChar = splittedC[2];
- input = input.Replace(oldChar, newChar);
- Console.WriteLine(input);
- }
- else if (newCom == "Includes")
- {
- string str = splittedC[1];
- if (input.Contains(str))
- {
- Console.WriteLine(true);
- }
- else
- {
- Console.WriteLine(false);
- }
- }
- else if (newCom == "Start")
- {
- string str = splittedC[1];
- if (input.IndexOf(str) == 0)
- {
- Console.WriteLine(true);
- }
- else
- {
- Console.WriteLine(false);
- }
- }
- else if (newCom == "Lowercase")
- {
- input = input.ToLower();
- Console.WriteLine(input);
- }
- else if (newCom == "FindIndex")
- {
- string findStr = splittedC[1];
- Console.WriteLine(input.LastIndexOf(findStr));
- }
- else if (newCom == "Remove")
- {
- int startIndex = int.Parse(splittedC[1]);
- int count = int.Parse(splittedC[2]);
- if (startIndex >= 0 && count <= input.Length)
- {
- input = input.Remove(startIndex, count);
- Console.WriteLine(input);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment