GoogleAnalyticsUtils.EventsReporter.EscapeValue C# (CSharp) Метод

EscapeValue() приватный статический Метод

Escapes a value so it can be included in the GA hit and being able to parse them again on the backend Only the ',', '=' and '\\' characters need to be escaped as those are the separators for the values, in the string.
private static EscapeValue ( string value ) : string
value string
Результат string
        private static string EscapeValue(string value)
        {
            var result = new StringBuilder();
            foreach (var c in value)
            {
                switch (c)
                {
                    case ',':
                    case '=':
                    case '\\':
                        result.Append($@"\{c}");
                        break;

                    default:
                        result.Append(c);
                        break;
                }
            }
            return result.ToString();
        }