码道至简

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
根据ASCII码表来判断该字符是否为逗号 此方法效率较低

//中文逗号转英文逗号 public string YingDaoZhong(string Ying) { string rest = ""; char douHao = ''; int a = douHao; // MessageBox.Show(a.ToString()); for (int i = 0; i < Ying.Length; i++) { char c = Ying[i]; if (c == douHao) { rest += ","; } else { rest += Ying[i]; } } return rest; } //中文逗号转英文逗号 public string ZhongDaoYing(string Zhong) { string rest = ""; char douHao = ','; int a = douHao; // MessageBox.Show(a.ToString()); for (int i = 0; i < Zhong.Length; i++) { char c = Zhong[i]; if (c == douHao) { rest += ""; } else { rest += Zhong[i]; } } return rest; }

 

posted on 2017-12-21 22:38  码道至简  阅读(1770)  评论(0编辑  收藏  举报