[Solved] How to prepend a word with a letter if the first letter of that word is upper-case?
Using a regex: string paragraphWord = “This is A String of WoRDs”; var reg = new Regex(@”(?<=^|\W)([A-Z])”); Console.WriteLine(reg.Replace(paragraphWord,”k$1″)); Explaining (?<=^|\W)([A-Z]) ?<= positive look behind ^|\W start of the string or a whitespace character [A-Z] A single upper case letter So we are looking for a single upper case letter proceeded by either the start of … Read more