SysUtils.StrUpper、SysUtils.StrLower

1640 ワード

StrUpperとStrLowerはPChar列の大文字と小文字を変換する関数である.
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
const
  arr: array[0..3] of Char = 'aBcD';
begin
  StrLower(arr);
  ShowMessage(arr); {abcd}

  StrUpper(arr);
  ShowMessage(arr); {ABCD}
end;


procedure TForm1.Button2Click(Sender: TObject);
var
  p: PChar;
begin
  GetMem(p, 18);

  StrCopy(p, '  Delphi  ');

  StrLower(p);
  ShowMessage(p); {  delphi  }

  StrUpper(p);
  ShowMessage(p); {  DELPHI  }

  FreeMem(p);
end;


procedure TForm1.Button3Click(Sender: TObject);
var
  p,pr: PChar;
begin
  p := PChar(StringOfChar(#0, 18));

  StrCopy(p, '  Delphi  ');

  StrLower(p);
  ShowMessage(p); {  delphi  }

  StrUpper(p);
  ShowMessage(p); {  DELPHI  }

  StrIComp();
  StrLComp();
  StrLIComp()
end;

end.

 
 
 
 
 

 

 
  
SysUtilsユニットの下にある共通関数ディレクトリ