Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- namespace StringOp
- {
- class Program
- {
- static string Capitals(string text)
- {
- string cap = "";
- bool isCapital = false;
- foreach (char symbol in text)
- {
- if (symbol == '[')
- {
- isCapital = true;
- }
- else if (symbol == ']')
- {
- isCapital = false;
- }
- else
- {
- if (isCapital)
- {
- cap += char.ToUpper(symbol);
- }
- else
- {
- cap += symbol;
- }
- }
- }
- return cap;
- }
- static void Main(string[] args)
- {
- string text = "Hello. I'm [from] Pravets! I'm C# [developer]!";
- // Hello. I'm FROM Pravets! I'm C# DEVELOPER!
- Console.WriteLine(Capitals(text));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement