public static string UnescapePartitionKey()

in src/DurableTask.AzureStorage/Tracking/KeySanitation.cs [94:142]


        public static string UnescapePartitionKey(string key)
        {
            if (key == null)
            {
                return null;
            }

            StringBuilder b = new StringBuilder();
            for (int i = 0; i < key.Length; i++)
            {
                char c = key[i];
                if (c != escapeChar)
                {
                    b.Append(c);
                }
                else
                {
                    c = key[++i];
                    switch (c)
                    {
                        case escapeChar: b.Append(escapeChar); break;

                        case '0':
                            b.Append('/');
                            break;

                        case '1': 
                            b.Append('\\');
                            break;

                        case '2': 
                            b.Append('#');
                            break;

                        case '3': 
                            b.Append('?'); 
                            break;

                        default:
                            {
                                char shiftedBack = (c < offset) ? c : (char)(c - offset);
                                b.Append(shiftedBack);
                                break;
                            }
                    }
                }
            }
            return b.ToString();
        }