View Code
 1 /// <summary>
 2         /// 从字符串中提取数字,并组合成日期格式
 3         /// </summary>
 4         /// <param name="str">字符串参数</param>
 5         /// <returns>提取后的字符串</returns>
 6         private string DrawNumber(string str)
 7         {
 8             string result = string.Empty;
 9             foreach (char item in str)
10             {
11                 if (item >= 48 && item <= 58)
12                 {
13                     result += item;
14                 }
15             }
16             result = result.Insert(4, "/");
17             result = result.Insert(7, "/");
18             return result;
19         }

 

posted on 2012-05-11 11:58  捣乃忒  阅读(200)  评论(0编辑  收藏  举报