public void QuoteUnescape_1() { string src = "\"Comma [,]#$xPercent [%]#$xDoubleQuote [#$q]#$xSpace [ ]#$xTab [#$t]#$xSharp [##]#$xNewLine [#$x]\""; string dest = StringEscaper.QuoteUnescape(src); string comp = StringEscaperTests.SampleString; Assert.IsTrue(dest.Equals(comp, StringComparison.Ordinal)); }
public static void QuoteUnescapeArrayTemplate(string[] srcs, bool escapePercent, string[] expects) { List <string> dests = StringEscaper.QuoteUnescape(srcs, escapePercent); for (int i = 0; i < dests.Count; i++) { Assert.IsTrue(dests[i].Equals(expects[i], StringComparison.Ordinal)); } }
private void UnescapeStringCommand_Executed(object sender, ExecutedRoutedEventArgs e) { UnescapeButton.Focus(); string str = StringEscaper.QuoteUnescape(_m.EscaperStringToConvert); _m.EscaperConvertedString = _m.EscaperEscapePercentFlag ? StringEscaper.UnescapePercent(str) : str; ConvertedStringTextBox.Focus(); }
private void UnescapeButton_Click(object sender, RoutedEventArgs e) { string str = StringEscaper.QuoteUnescape(m.Escaper_StringToConvert); if (m.Escaper_EscapePercent) { m.Escaper_ConvertedString = StringEscaper.UnescapePercent(str); } else { m.Escaper_ConvertedString = str; } }
public void QuoteUnescape_2() { string[] srcs = new string[] { "\"Comma [#$c]\"", "\"Space [ ]\"", "\"DoubleQuote [#$q]\"", }; List <string> dests = StringEscaper.QuoteUnescape(srcs); string[] comps = new string[] { "Comma [,]", "Space [ ]", "DoubleQuote [\"]", }; for (int i = 0; i < dests.Count; i++) { Assert.IsTrue(dests[i].Equals(comps[i], StringComparison.Ordinal)); } }
public static void QuoteUnescapeTemplate(string src, bool escapePercent, string expected) { string dest = StringEscaper.QuoteUnescape(src, escapePercent); Assert.IsTrue(dest.Equals(expected, StringComparison.Ordinal)); }