예제 #1
0
        public static string ToEncodeUTF8(this string text)
        {
            if (text.IsNullOrEmpty())
            {
                return(text);
            }

            var textFormated = string.Empty;

            //execução
            text = text.Replace("saída", "saída");
            text = text.Replace("ÃO", "ão");
            text = text.Replace("ão", "ão");
            text = text.Replace("Ç", "Ç");
            text = text.Replace("ç", "ç");
            text = text.Replace("possível", "possí­vel");
            text = text.Replace("Transferência­vel", "Transferência");

            if (HelperExtension.HasEncodeInText(text))
            {
                var textSplit = text.Split(' ');

                foreach (var textTemp in textSplit)
                {
                    var textEncoded = textTemp;
                    if (HelperExtension.HasEncodeInText(textEncoded))
                    {
                        textEncoded = System.Text.Encoding.UTF8.GetString(System.Text.Encoding.GetEncoding("iso-8859-1").GetBytes(textEncoded.DefaultString()));
                    }

                    textFormated += $" {textEncoded}";
                }
            }
            else
            {
                return(text);
            }

            return(textFormated.Trim());
        }
예제 #2
0
        public static List <string> GetStringList <T>()
        {
            T[] array = HelperExtension.ToArray <T>();

            return(array.Select(a => Convert.ToString(a)).ToList());
        }
예제 #3
0
        public static List <int> GetIdList <T>()
        {
            T[] array = HelperExtension.ToArray <T>();

            return(array.Select(a => Convert.ToInt32(a)).ToList());
        }