一个小问题,就是文本超出指定的长度时,显示省略号c#

解决方案 »

  1.   

     static void Main(string[] args)
            {
                string result = 处理字符串("hello world hello world hello world hello world hello world hello world");
                Console.WriteLine(result);
            }        public static string 处理字符串(string str)
            {
                if (str.Length > 20)
                {
                    return str.Substring(0, 20) + "...";
                }
                return str;
            }
      

  2.   

    本帖最后由 caozhy 于 2013-08-27 15:03:40 编辑