System.SysUtils.SameText

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

function SameText(const S1, S2: string): Boolean;
function SameText(const S1, S2: string; LocaleOptions: TLocaleOptions): Boolean;

C++

extern DELPHI_PACKAGE bool __fastcall SameText(const System::UnicodeString S1, const System::UnicodeString S2)/* overload */;

プロパティ

種類 可視性 ソース ユニット
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

説明

2 つの文字列を大文字/小文字を区別せずに順序値で比較します。


SameTextS1S2 を比較し、両者が等しければ True を返します。SameText は大文字/小文字を区別せず、現在のロケールには影響されません。

メモ: OSX、iOS、Android の各プラットフォームでは、LocaleOptions パラメータの値として loUserLocale を使用する場合、制御文字(文字コードが #00 から #31 までのもの)はすべて、SameText による比較では同じ文字と見なされます。

 procedure TForm1.Button1Click(Sender: TObject);
 var
   c1, c2: string;
 begin
   c1 := char(6);
   c2 := char(31);
   showmessage(BoolToStr(SameText(c1, c2, loUserLocale), true));
   
   c1 := 'p'+char(6)+'p';
   c2 := 'p'+char(31)+'p';
   showmessage(BoolToStr(SameText(c1, c2, loUserLocale), true));
 end;

どちらの例でも、結果は、Windows プラットフォームの場合は False になり、OSX、iOS、Android の各プラットフォームの場合は True になります。


関連項目