bonjour, je souhaiterais enlever les accents d'une chaîne de caractères, je suppose que c'est pareil qu'en delphi, il n'y a pas de fonctions toutes faites, je n'arrive pas à adapter mon code delphi en C # , quelqu'un saurait-il m'aider ? Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 function RemoveAcute(const S: string): string; var PResult : PChar; PStr : PChar; begin Result := S; PResult := PChar(Result); PStr := PChar(S); while PStr[0] <> #0 do begin case PStr[0] of #192..#197 : PResult[0] := 'A'; #199 : PResult[0] := 'C'; #200..#203 : PResult[0] := 'E'; #204..#207 : PResult[0] := 'I'; #209 : PResult[0] := 'N'; #210..#214 : PResult[0] := 'O'; #138 : PResult[0] := 'S'; #217..#220 : PResult[0] := 'U'; #159,#221 : PResult[0] := 'Y'; #142 : PResult[0] := 'Z'; #224..#229 : PResult[0] := 'a'; #231 : PResult[0] := 'c'; #232..#235 : PResult[0] := 'e'; #236..#239 : PResult[0] := 'i'; #241 : PResult[0] := 'n'; #242..#246 : PResult[0] := 'o'; #154 : PResult[0] := 's'; #249..#252 : PResult[0] := 'u'; #253,#255 : PResult[0] := 'y'; #158 : PResult[0] := 'z'; end; inc(PResult); inc(PStr); end; end;
Partager