Created
March 12, 2018 06:59
-
-
Save MerlinTwi/c25cbd3a6adf9b9b8db57c4dbfb5c505 to your computer and use it in GitHub Desktop.
Replace quotes ".." to pair «..»
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static string ReplaceQuotes(string s) { | |
| var quotes = new[] { "«", "»" }; | |
| int n = 0; | |
| while (true) { | |
| int i = s.IndexOf("\"", StringComparison.Ordinal); | |
| if (i < 0) break; | |
| s = s.Substring(0, i) + quotes[n++%quotes.Length] + s.Substring(i + 1); | |
| } | |
| return s; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment