From 80afa2c0aec37b7f98cc22615417c36672e695da Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 28 Apr 2020 00:35:52 -0400 Subject: tidy up, work on stateful --- IrcStates/Casemap.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'IrcStates/Casemap.cs') diff --git a/IrcStates/Casemap.cs b/IrcStates/Casemap.cs index 484c490..67867c5 100644 --- a/IrcStates/Casemap.cs +++ b/IrcStates/Casemap.cs @@ -17,10 +17,7 @@ namespace IrcStates private static string Replace(string s, string upper, string lower) { - for (var i = 0; i < upper.Length; ++i) - { - s = s.Replace(upper[i], lower[i]); - } + for (var i = 0; i < upper.Length; ++i) s = s.Replace(upper[i], lower[i]); return s; } @@ -28,14 +25,12 @@ namespace IrcStates public static string CaseFold(CaseMapping mapping, string s) { if (s != null) - { return mapping switch { CaseMapping.Rfc1459 => Replace(s, Rfc1459UpperChars, Rfc1459LowerChars), - CaseMapping.Ascii => Replace(s, AsciiUpperChars, AsciiLowerChars), - _ => throw new ArgumentOutOfRangeException(nameof(mapping), mapping, null) + CaseMapping.Ascii => Replace(s, AsciiUpperChars, AsciiLowerChars), + _ => throw new ArgumentOutOfRangeException(nameof(mapping), mapping, null) }; - } return string.Empty; } -- cgit 1.4.1