将字符串"123456"转换成"1,2,3,4,5,6"

        /// <summary>
        
/// 将字符串"123456"转换成"1,2,3,4,5,6"
        
/// </summary>
        
/// <param name="code">要转换的字符串</param>
        
/// <returns>转换结果</returns>
        protected string ConvertString(string code)
        {
            string result = string.Empty;
            for (int i = 0; i < code.Length; i++)
            {
                result += string.Format("{0},", code.Substring(i, 1));
            }
            return result.Remove(result.Length - 1);
        }
posted @ 2012-01-06 15:55  ゞ追忆o0ゞ  阅读(1405)  评论(0编辑  收藏  举报