Replace all accents in the given string. - CSharp System

CSharp examples for System:String Replace

Description

Replace all accents in the given string.

Demo Code


using System.Xml.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
using System.IO;//from ww  w  .  jav  a 2s. c o  m
using System.Globalization;
using System.Data.Entity.ModelConfiguration.Design.PluralizationServices;
using System;

public class Main{
        #endregion RemoveSpecial

        #region ReplaceAccents

        /// <summary>
        /// Replace all accents in the given string.
        /// </summary>
        public static string ReplaceAccents(string strInput)
        {
            byte[] arrBytes = Encoding.GetEncoding(1251).GetBytes(strInput);
            return Encoding.ASCII.GetString(arrBytes);
        }
}

Related Tutorials