Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace CaseSwitcher
- {
- using System;
- using System.Text.RegularExpressions;
- public class CaseSwitcher
- {
- public static string TakeUserInput(string adviseString)
- {
- Console.WriteLine(adviseString);
- string userExpression = Console.ReadLine();
- return userExpression;
- }
- public static void Main(string[] args)
- {
- string userString = TakeUserInput("Enter a string with necessary tags: ");
- string changedString = Regex.Replace(
- userString,
- @"(?<=<upcase>)(.+?)(?=</upcase>)",
- delegate(Match match)
- {
- string text = match.ToString();
- return text.ToUpper();
- });
- changedString = Regex.Replace(changedString, @"<.+?>", string.Empty);
- Console.WriteLine();
- Console.WriteLine(changedString);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement