private string getSubStr(string sourceStr, int len)
        {
            string temp = sourceStr;
            if (Regex.Replace(temp, "[\u4e00-\u9fa5]", "aa", RegexOptions.IgnoreCase).Length <= len)
            {
                return temp;
            }

            for (int i = temp.Length; i >= 0; i--)
            {
                temp = temp.Substring(0, i);
                if (Regex.Replace(temp, "[\u4e00-\u9fa5]", "aa", RegexOptions.IgnoreCase).Length <= len)
                {
                    return temp;
                }
            }
            return "";
        }
posted on 2009-04-09 15:54  赵保龙  阅读(316)  评论(0)    收藏  举报