Sign in Join
Wiki copytemporary

Palindrome/fr: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-<figure>
2-<img src="fpc_source_logo.png" title="fpc_source_logo.png" />
3-<figcaption>fpc_source_logo.png</figcaption>
4-</figure>
1+![](/wiki-images/8/84/Fpc_source_logo.png)
52
63# Palindrome
74
85Un palindrome est un mot, une phrase, un nombre ou une autre séquence de symboles ou d'éléments, dont le sens peut être interprété de la même manière dans les deux sens de lecture.
96
107# Exemples
118
129## Anglais
1310
1411- racecar
1512- A man, a plan, a canal: Panama
1613- Madam I'm Adam
1714
1815## Arabe
1916
2017- مودته تدوم لكل هول * وهل كل مودته تدوم
2118
2219## Arménien
2320
2421- Արա իմ, առած դրամ՝ քաղաքեքաղաք մարդ ծառա մի արա
2522- Սերամա՜հ եթե համարես
2623
2724## Finnois
2825
2926- saippuakivikauppias
3027- No niin, on aamu. Kehua sinua kai saan, ah, ihana Kristian. Nait Sirkan, ah, ihana asia, kaunis. Au, hekumaa. No niin on.
3128- No, oikotie vei Tokioon.
3229
3330## Russe
3431
3532- А роза упала на лапу Азора
3633- луну дунул
3734- лак резала зеркал
3835
3936## Français
4037
4138- La mariée ira ma
4239- Noël a trop par rapport à Léon
4340- Ésope reste ici et se repose
4441- a nana snob porte de trop bons ananas
4542- Éric notre valet alla te laver ton ciré (vous pouvez remplacer Eric par Luc;-)
4643
4744# Fonction IsPalindome
4845
4946Cette fonction convient à la fois pour les encodages ASCII et UTF-8.
5047
5148``` pascal
5249function IsPalindome(const a_text: string): boolean;
5350var
5451 i, j :longint;
5552 s1, s2, s3 :string;
5653begin
5754 s1 := UTF8LowerCase( a_text );
5855 j := length( s1 );
5956 i := 1;
6057 s2 := '';
6158 s3 := '';
6259 while ( i <= j ) do
6360 begin
6461 if s1[i] < #$C0 then // ASCII
6562 begin
6663 if (s1[i] >= #$30) and (s1[i] < #$7B)then
6764 begin
6865 if (s1[i] > #$60) or (s1[i] < #$3A) then
6966 begin
7067 s2 := s1[i] + s2;
7168 s3 := s3 + s1[i];
7269 end;
7370 end;
7471 inc( i );
7572 end
7673 else
7774 begin
7875 begin
7976 if s1[i] < #$E0 then // two byte
8077 begin
8178 if ((s1[i] > #$C2) and ( not
8279 // Armenian punctuation
8380 ((s1[i] = #$D5) and ((s1[i+1] >= #$99) and (s1[i+1] < #$A0)))
8481 )) then
8582 begin
8683 s2 := s1[i]+ s1[i+1] + s2;
8784 s3 := s3 + s1[i] + s1[i+1];
8885 end;
8986 inc( i ,2);
9087 end
9188 else
9289 begin
9390 if s1[i] < #$F0 then // three byte
9491 begin
9592 if not (
9693 // General punctuation
9794 (s1[i] = #$E2) and ((s1[i+1]= #$80)
9895 or ((s1[i+1]= #$81) and (s1[i+2]< #$B0)))
9996 ) then
10097 begin
10198 s2 := s1[i]+ s1[i+1] + s1[i+2]+ s2;
10299 s3 := s3 + s1[i] + s1[i+1] + s1[i+2];
103100 end;
104101 inc( i ,3);
105102 end
106103 else
107104 begin
108105 s2 := s1[i]+ s1[i+1] + s1[i+2]+ s1[i+3] + s2;
109106 s3 := s3 + s1[i] + s1[i+1] + s1[i+2] + s1[i+3];
110107 inc( i ,4);
111108 end
112109 end;
113110 end;
114111 end;
115112 end;
116113 if s2 <> '' then result := s2=s3 else result := false;
117114end;
118115```
119116
120117---
121118*From the Free Pascal wiki, page "Palindrome/fr", as it stood on 2020-02-23 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history