Advertisement
StreetKatya

Decode

May 4th, 2022
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. public string Decoding()
  2.         {
  3.             StringBuilder newtext = new StringBuilder();
  4.             StringBuilder line = new StringBuilder();
  5.             var slovar = new Dictionary<string, char>();
  6.             slovar = CodingDict.ToDictionary(x => x.Value, x => x.Key);    
  7.             for (int i = 1; i < EncodingText.Length; i++)
  8.             {
  9.                line.Append(EncodingText[i]);
  10.                 string symbol = line.ToString();
  11.                 if (slovar.ContainsKey(symbol))
  12.                 {
  13.                     newtext.Append(slovar[symbol]);
  14.                     line.Clear();
  15.                 }
  16.             }
  17.             return newtext.ToString();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement