Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Window.Resources>
- <v:MyClass x:Key="whatever" Text="foonbar" />
- </Window.Resources>
- <TextBlock Text="Hello World!"/>
- <v:MyClass x:Key="whatever">
- foo
- bar
- </v:MyClass>
- <TextBlock>
- Line 1
- <LineBreak />
- Line 2
- </TextBlock>
- string s = "foo\nbar";
- s = s.Replace("\n", "n");
- using System.Text.RegularExpressions;
- // snip
- string s = "foo\nbar";
- Regex r = new Regex("\\[rnt\\]");
- s = r.Replace(s, ReplaceControlChars); ;
- // /snip
- string ReplaceControlChars(Match m)
- {
- switch (m.ToString()[1])
- {
- case 'r': return "r";
- case 'n': return "n";
- case '\': return "\";
- case 't': return "t";
- // some control character we don't know how to handle
- default: return m.ToString();
- }
- }
Add Comment
Please, Sign In to add comment