Exemple #1
0
        public static string SubStr(string s, int i, string smore)
        {
            int    num  = 0;
            int    num2 = 0;
            string result;

            if (Globals.GetStrLen(s) > i)
            {
                for (int j = 0; j < s.Length; j++)
                {
                    char c = s[j];
                    if (num >= i)
                    {
                        break;
                    }
                    num2++;
                    if (c > '\u007f')
                    {
                        num += 2;
                    }
                    else
                    {
                        num++;
                    }
                }
                string str = s.Substring(0, num2 - Globals.GetStrLen(smore));
                result = str + smore;
            }
            else
            {
                result = s;
            }
            return(result);
        }