Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- using System.Text;
- class TransformUpper
- {
- static void Main()
- {
- string text = "We are living in a <upcase>yellow submarine</upcase>. We don't have <upcase>anything</upcase> else.";
- char[] textArray = text.ToCharArray();
- int index = 0;
- while ((index = text.IndexOf("<upcase>", index)) != -1)
- {
- index += 8;
- while (textArray[index] != '<')
- {
- textArray[index] = Char.ToUpper(textArray[index]);
- index++;
- }
- }
- text = new string(textArray);
- text = text.Replace("<upcase>", "").Replace("</upcase>", "");
- Console.WriteLine(text);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement