{"id":178,"date":"2019-09-30T22:32:19","date_gmt":"2019-09-30T19:32:19","guid":{"rendered":"http:\/\/www.potansif.com\/?p=178"},"modified":"2019-10-01T00:49:53","modified_gmt":"2019-09-30T21:49:53","slug":"editte-turkce-karakter-sorunu","status":"publish","type":"post","link":"http:\/\/www.potansif.com\/?p=178","title":{"rendered":"Edit&#8217;te T\u00fcrk\u00e7e Karakter Sorunu"},"content":{"rendered":"<p><b>Soru<\/b><\/p>\n<p>Kullan\u0131c\u0131n\u0131n Edit&#8217;e girdi\u011fi harflerin k\u00fc\u00e7\u00fck harf olmas\u0131n\u0131 sa\u011flamak istiyorum. \u0130lk harf b\u00fcy\u00fck olacak fakat &#8220;\u0130&#8221; olas\u0131 gerekirken &#8220;\u0131&#8221; olarak yaz\u0131yor.&nbsp;T\u00fcrk\u00e7e karakterle ilgili sorunum var UTF-8&#8217;i ara\u015ft\u0131rd\u0131m fakat Firemonkey&#8217;de \u00e7\u00f6z\u00fcm bulamad\u0131m, yard\u0131mlar\u0131n\u0131z\u0131 rica ederim.<!--more--><\/p>\n<pre><code>function degis(Harf: String): String;\nconst\n  Buyuk: String = 'ABC\u00c7DEFGGHI\u0130JKLMNO\u00d6PRS\u015eTU\u00dcVYZQW';\n  Degis: String = 'abc\u00e7defg\u011fh\u0131ijklmno\u00f6prs\u015ftu\u00fcvyzqw';\nvar\n  N: Integer;\nbegin\n  for N := 1 to Length(Buyuk) do\n    while Pos(Buyuk[N], Harf) &gt; 0 do\n      Harf[Pos(Buyuk[N], Harf)] := Degis[N];\n  Result := AnsiUpperCase(Harf[1]) + Copy(Harf, 2, Length(Harf));\nend;\n\nprocedure TForm1.EditChangeTracking(Sender: TObject);\nbegin\n  if Edit.Text.Length &gt; 0 then begin\n     Edit1.Text := degis(Edit1.Text);\n  end;\nend;<\/code><\/pre>\n<p><b>Cevap<\/b><\/p>\n<p>Belki daha efektif yaz\u0131labilirdi ama &#8220;degis&#8221; fonksiyonu yerine \u015f\u00f6yle bir fonksiyon ile sorunu \u00e7\u00f6zebilirsiniz;<\/p>\n<pre><code>function LowerCaseTR(aString: String; aBuyukBasHarf: Boolean = True): String;\nconst\n  K = 'aeirl\u0131dknmyustbo\u00fc\u015fzgh\u00e7\u011fcvp\u00f6fjwx';   \/\/ Harflerin b\u00f6yle s\u0131ralanmas\u0131n\u0131n sebebi\n  B = 'AE\u0130RLIDKNMYUSTBO\u00dc\u015eZGH\u00c7\u011eCVP\u00d6FJWX';   \/\/ bunlar\u0131n T\u00fcrk\u00e7edeki kullan\u0131m s\u0131kl\u0131klar\u0131na g\u00f6redir.\nvar\n  I: Integer;                              \/\/ Saya\u00e7, indis de\u011fi\u015fkeni\n  X: Integer;                              \/\/ Bulunan harfin alfabedeki indis numaras\u0131\nbegin\n  Result := aString;\n  for I := 1 to Result.Length do begin     \/\/ metni harf harf geziyoruz. (Bir rakam ile de kar\u015f\u0131la\u015fabiliriz...)\n      X := pos(Result[I], B);              \/\/ POS, b\u00fcy\u00fck \/ k\u00fc\u00e7\u00fck harfe duyarl\u0131d\u0131r (Case Sensitive). Yani b\u00fcy\u00fckse k\u00fc\u00e7\u00fc\u011f\u00fc, k\u00fc\u00e7\u00fckse b\u00fcy\u00fc\u011f\u00fc vermez.\n      if (X &gt; 0) then Result[I] := K[X];   \/\/ Bulunan karakter alfabemizde varsa, k\u00fc\u00e7\u00fc\u011f\u00fcyle yer de\u011fi\u015ftiriyoruz.\n  end;\n  if (aBuyukBasHarf = True) then\n      for I := 1 to Result.Length do begin \/\/ Metni harf harf geziyoruz\n          X := pos(Result[I], K);          \/\/ Burada harften ba\u015fka bir karakter ile de kar\u015f\u0131la\u015fabiliriz\n          if (X &gt; 0) then begin            \/\/ O nedenle, bulunan karakter bir harf ise X, s\u0131f\u0131rdan b\u00fcy\u00fck olur...\n              Result[I] := B[X];\n              Exit;                        \/\/ \u0130lk harfi b\u00fcy\u00fctt\u00fckten sonra \u00e7\u0131k\u0131yoruz...\n          end;\n      end;\nend;<\/code><\/pre>\n<p>Bilgi mahiyetinde T\u00fcrk\u00e7e harflerin kullan\u0131m oranlar\u0131n\u0131 g\u00f6steren bilgiler a\u015fa\u011f\u0131da yer al\u0131yor.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-613\" src=\"http:\/\/rubicube.com.tr\/wp-content\/uploads\/2018\/09\/oOk8bm1.jpg\" alt=\"\" width=\"756\" height=\"445\"><\/p>\n<p>Veri Kayna\u011f\u0131;<\/p>\n<ul>\n<li><a href=\"http:\/\/www.wseas.us\/e-library\/conferences\/2011\/Cambridge\/NEHIPISIC\/NEHIPISIC-20.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.wseas.us\/e-library\/conferences\/2011\/Cambridge\/NEHIPISIC\/NEHIPISIC-20.pdf<\/a><\/li>\n<li><a href=\"http:\/\/www.wikizero.co\/index.php?q=aHR0cHM6Ly90ci53aWtpcGVkaWEub3JnL3dpa2kvVMO8cmtfYWxmYWJlc2luZGVraV9oYXJmbGVyaW5fa3VsbGFuxLFtX3PEsWtsxLFrbGFyxLE\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.wikizero.co\/index.php?q=aHR0cHM6Ly90ci53aWtpcGVkaWEub3JnL3dpa2kvVMO8cmtfYWxmYWJlc2luZGVraV9oYXJmbGVyaW5fa3VsbGFuxLFtX3PEsWtsxLFrbGFyxLE<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kullan\u0131c\u0131n\u0131n Edit&#8217;e girdi\u011fi harflerin k\u00fc\u00e7\u00fck harf olmas\u0131n\u0131 sa\u011flamak istiyorum. \u0130lk harf b\u00fcy\u00fck olacak fakat &#8220;\u0130&#8221; olas\u0131 gerekirken &#8220;\u0131&#8221; olarak yaz\u0131yor.\u00a0T\u00fcrk\u00e7e karakterle ilgili sorunum var UTF-8&#8217;i ara\u015ft\u0131rd\u0131m fakat Firemonkey&#8217;de \u00e7\u00f6z\u00fcm bulamad\u0131m, yard\u0131mlar\u0131n\u0131z\u0131 rica ederim.<\/p>\n","protected":false},"author":1,"featured_media":201,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[56,57,58,60,11,44,59,61],"class_list":["post-178","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-alfabe","tag-ansichar","tag-firemonkey","tag-pos","tag-programlama","tag-soru-cevap","tag-turkce","tag-utf8"],"_links":{"self":[{"href":"http:\/\/www.potansif.com\/index.php?rest_route=\/wp\/v2\/posts\/178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.potansif.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.potansif.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.potansif.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.potansif.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=178"}],"version-history":[{"count":1,"href":"http:\/\/www.potansif.com\/index.php?rest_route=\/wp\/v2\/posts\/178\/revisions"}],"predecessor-version":[{"id":185,"href":"http:\/\/www.potansif.com\/index.php?rest_route=\/wp\/v2\/posts\/178\/revisions\/185"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.potansif.com\/index.php?rest_route=\/wp\/v2\/media\/201"}],"wp:attachment":[{"href":"http:\/\/www.potansif.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.potansif.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.potansif.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}