Decode() public static méthode

decoduje string zamienia wpisy (=?...?=) na odp wartosci
public static Decode ( string s ) : string
s string "ala i =?iso-8859-2?Q?Kupis_Pawe=B3?= ma kota"
Résultat string
Exemple #1
0
        /// <summary>
        /// z 'ala="123"'
        /// </summary>
        /// <param name="key">ala=</param>
        /// <returns>123</returns>
        protected string GetValueEqualFromHeader2(string key)
        {
            bool noQuotes = false;
            int  end      = -1;
            int  start    = header.IndexOf(key);

            if (start == -1)
            {
                return("");
            }
            start = header.IndexOf('"', start);
            if (start == -1)
            {
                noQuotes = true;
                start    = header.IndexOf('=', header.IndexOf(key));
            }
            if (noQuotes)
            {
                end = header.IndexOf("\r\n", start + 1);
            }
            else
            {
                end = header.IndexOf('"', start + 1);
            }
            if (start == -1 || end == -1)
            {
                return("");
            }
            return(QuotedCoding.Decode(header.Substring(start + 1, end - start - 1)));
        }
Exemple #2
0
        /// <summary>
        /// z 'ala="123"'
        /// </summary>
        /// <param name="key">ala=</param>
        /// <returns>123</returns>
        protected string GetValueEqualFromHeader(string key)
        {
            int start = header.IndexOf(key);

            if (start == -1)
            {
                return("");
            }
            start = header.IndexOf('"', start);
            int end = header.IndexOf('"', start + 1);

            if (start == -1 || end == -1)
            {
                return("");
            }
            return(QuotedCoding.Decode(header.Substring(start + 1, end - start - 1)));
        }
Exemple #3
0
        protected string GetValueFromHeader(string key)
        {
            int start = header.ToLower().IndexOf(key.ToLower());

            if (start < 0)
            {
                return("");
            }
            start = header.IndexOf(' ', start);
            if (start < 0)
            {
                return("");
            }
            int end = header.IndexOf("\r\n", start);

            if (end <= 0)
            {
                return("");
            }
            return(QuotedCoding.Decode(header.Substring(start + 1, end - start - 1).Trim()));
        }