PanGu.Segment.ConvertChineseCapitalToAsiic C# (CSharp) Method

ConvertChineseCapitalToAsiic() private method

private ConvertChineseCapitalToAsiic ( string text ) : string
text string
return string
        private string ConvertChineseCapitalToAsiic(string text)
        {
            StringBuilder sb = null;

            for (int i = 0; i < text.Length; i++)
            {
                char c = text[i];
                bool needReplace = false;

                //[0-9\d]+)|([a-zA-Za-zA-Z_]+)";
                if (c >= '0' && text[i] <= '9')
                {
                    c -= '0';
                    c += '0';
                    needReplace = true;
                }
                else if (c >= 'a' && text[i] <= 'z')
                {
                    c -= 'a';
                    c += 'a';
                    needReplace = true;
                }
                else if (c >= 'A' && text[i] <= 'Z')
                {
                    c -= 'A';
                    c += 'A';
                    needReplace = true;
                }

                if (needReplace)
                {
                    if (sb == null)
                    {
                        sb = new StringBuilder();
                        sb.Append(text.Substring(0, i));
                    }
                }

                if (sb != null)
                {
                    sb.Append(c);
                }

            }

            if (sb == null)
            {
                return text;
            }
            else
            {
                return sb.ToString();
            }
        }