雷火电竞-中国电竞赛事及体育赛事平台

歡迎來到入門教程網(wǎng)!

C#教程

當(dāng)前位置:主頁 > 軟件編程 > C#教程 >

C# 刪除字符串中的中文(實例分享)

來源:本站原創(chuàng)|時間:2020-01-10|欄目:C#教程|點擊:

話不多說,請看代碼

/// <summary>
/// 刪除字符串中的中文
/// </summary>
public static string Delete中文(string str)
{
  string retValue = str;
  if (System.Text.RegularExpressions.Regex.IsMatch(str, @"[\u4e00-\u9fa5]"))
  {
    retValue = string.Empty;
    var strsStrings = str.ToCharArray();
    for (int index = 0; index < strsStrings.Length; index++)
    {
      if (strsStrings[index] >= 0x4e00 && strsStrings[index] <= 0x9fa5)
      {
        continue;
      }
      retValue += strsStrings[index];
    }
  }
  return retValue;
}

以上就是本文的全部內(nèi)容,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時也希望多多支持我們!

上一篇:C#漢字轉(zhuǎn)拼音實例(支持多音字)

欄    目:C#教程

下一篇:VS2012 程序打包部署圖文詳解

本文標(biāo)題:C# 刪除字符串中的中文(實例分享)

本文地址:http://www.jygsgssxh.com/a1/C_jiaocheng/6072.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有