SysUtilsStrLower (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses an edit box, a label, and a button on a form. When the button is clicked, the text in the edit control is displayed in lowercase in the label’s caption. The text is also displayed in uppercase in the label. Notice that lower is altered by the call to StrUpper. That is because the SysUtils.StrXXX functions actually alter their input strings.

Code

var
  S: array[0..20] of Char = 'A fUnNy StRiNg';

procedure TForm1.Button1Click(Sender: TObject);
var
  lower, upper: PChar;
begin
  lower:= StrLower(S);
  Caption:= lower;
  upper:= StrUpper(S);
  Canvas.TextOut(5, 10, lower + ' ' + upper);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Label1.Caption := S;
end;

Uses