Les Snippets

Connexion

Modifie les caractères spéciaux

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 17/05/2006 10:24:01 et initié par danielamaury [Liste]
Date de mise à jour : 27/08/2007 12:35:47
Vue : 14799
Catégorie(s) : Chaîne de caractères, WinForm, WebForm
Langages dispo pour ce code :
- ASP.NET 2.x, VB 2005
- VB6
- VB6, VBA
- ASP.NET 1.x, ASP.NET 2.x, C# 1.x, C# 2.x
- Delphi 5
- Voir tous les langages pour ce code snippet



Langage : C# 1.x , C# 2.x , ASP.NET 1.x , ASP.NET 2.x
Date ajout : 27/08/2007
Posté par fabrice69 [Liste]
DateMAJ : 27/08/2007
       /// <summary>
        /// Delete all Accents
        /// </summary>
        /// <param name="txt">Source String with accents and special Char</param>
        /// <returns>Source String without accents and special Char</returns>
        private static string DeleteAccentAndSpecialsChar(string OriginalText)
        {
            string strTemp = OriginalText;
            // Regex creation
            Regex regA = new Regex("[ã|à|â|ä|á|å]");
            Regex regAA = new Regex("[Ã|À|Â|Ä|Á|Å]");
            Regex regE = new Regex("[é|è|ê|ë]");
            Regex regEE = new Regex("[É|È|Ê|Ë]");
            Regex regI = new Regex("[í|ì|î|ï]");
            Regex regII = new Regex("[Í|Ì|Î|Ï]");
            Regex regO = new Regex("[õ|ò|ó|ô|ö]");
            Regex regOO = new Regex("[Õ|Ó|Ò|Ô|Ö]");
            Regex regU = new Regex("[ù|ú|û|ü|µ]");
            Regex regUU = new Regex("[Ü|Ú|Ù|Û]");
            Regex regY = new Regex("[ý|ÿ]");
            Regex regYY = new Regex("[Ý]");
            Regex regAE = new Regex("[æ]");
            Regex regAEAE = new Regex("[Æ]");
            Regex regOE = new Regex("[œ]");
            Regex regOEOE = new Regex("[Œ]");
            Regex regC = new Regex("[ç]");
            Regex regCC = new Regex("[Ç]");
            Regex regDD = new Regex("[Ð]");
            Regex regN = new Regex("[ñ]");
            Regex regNN = new Regex("[Ñ]");
            Regex regS = new Regex("[š]");
            Regex regSS = new Regex("[Š]");
            strTemp = regA.Replace(strTemp, "a");
            strTemp = regAA.Replace(strTemp, "A");
            strTemp = regE.Replace(strTemp, "e");
            strTemp = regEE.Replace(strTemp, "E");
            strTemp = regI.Replace(strTemp, "i");
            strTemp = regII.Replace(strTemp, "I");
            strTemp = regO.Replace(strTemp, "o");
            strTemp = regOO.Replace(strTemp, "O");
            strTemp = regU.Replace(strTemp, "u");
            strTemp = regUU.Replace(strTemp, "U");
            strTemp = regY.Replace(strTemp, "y");
            strTemp = regYY.Replace(strTemp, "Y");
            strTemp = regAE.Replace(strTemp, "ae");
            strTemp = regAEAE.Replace(strTemp, "AE");
            strTemp = regOE.Replace(strTemp, "oe");
            strTemp = regOEOE.Replace(strTemp, "OE");
            strTemp = regC.Replace(strTemp, "c");
            strTemp = regCC.Replace(strTemp, "C");
            strTemp = regDD.Replace(strTemp, "D");
            strTemp = regN.Replace(strTemp, "n");
            strTemp = regNN.Replace(strTemp, "N");
            strTemp = regS.Replace(strTemp, "s");
            strTemp = regSS.Replace(strTemp, "S");
            return strTemp;

            return strTemp;
        }
Remarque :
Fonctionnement en C# pour tous les caractères spéciaux

Snippets en rapport avec : Caractères, Spéciaux



Codes sources en rapport avec : Caractères, Spéciaux

{Javascript / DHTML} CONVERSION TEXTE ACCENTUÉ -> CODE HTML
Etant donné que je n'ai pas trouvé de code qui permettait de me générer un code HTML à partir d'un t...

{Delphi} CONVERTIR LES CODE HTML EN CARACTÈRES SPÉCIAUX
Voici le complément à la source poster par Japee : http://www.delphifr.com/codes/CONVERTIR-CARACTE...

{PHP} CONVERSION DES CARACTÈRES SPÉCIAUX DANS UNE BASE DE DONNÉES MYSQL
Ce script convertit les caractères spéciaux tel que les simple quote ou les accents ... dans tous le...

{Delphi} CONVERTIR LES CARACTÈRES SPÉCIAUX EN CODE HTML [TEXT TO HTML]
Conversion des caractères spéciaux vers leur équivalent en code html. Ce code (simplifié) est ext...

{PHP} GÉNÉRER UNE CHAÎNE ALÉATOIRE SANS BOUCLE NI CRYPTAGE (MD5 OU AUTRE)
Jusqu'à présent tous les générateurs de clé que j'ai trouvé utilisait une boucle ou les fonction sha...

{Delphi} VFONTS : OUTIL DE VISUALISATION DES POLICES CARACTÈRES INSTALLÉES - RECHERCHES, CRÉATION DE SÉLECTION MÉMORISÉES, AIDE COMPLÈTE EN FRANÇAIS.
Ce petit logiciel, sous licence GPL, est destiné à vous aider à choisir certaines polices de caractè...

{C / C++ / C++.NET} [C/WIN32] GÉNÉRATEUR DE CODE POUR UNE INITIALISATION SPÉCIALE DE CHAINE DE CARACTÈRES.
Yop, Voici BNMgenerator, à comprendre BruNews Method Generator. J'espère qu'il me pardonnera ce n...

{PHP} FORMATAGE AUTOMATIQUE D'UN TEXT EN FONCTION DE MOTS CLÉES
Je cherchais depuis quelque temps un script me permettant de souligner, ou mettre en gras certain mo...

{Visual Basic, VB6, VB.NET, VB 2005} LIMITER LA FRAPPE DANS DES ZONES COMBO OU TEXT À DES CHIFFRES
Il s'agit d'une petite mise à jour pour VB.NET des astuces déjà existantes pour VB5 et VB6 qui avaie...

{Visual Basic, VB6, VB.NET, VB 2005} RECHERCHE DE CHAINE DE CARACTÉRES SUR DES FICHIERS .TXT AVEC SÉPARATEURS ENTRE LES CHAMPS, ET AFFICHAGE AVEC ALIGNEMENT DES ZONES.
Ce programme sert à 'RAPIDEMENT' chercher et afficher des lignes d'enregistrements d'un fichier de t...