RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.StrLower Function

Converts a string to lowercase.

Pascal
function StrLower(Str: PAnsiChar): PAnsiChar; overload;
function StrLower(Str: PWideChar): PWideChar; overload;
C++
PAnsiChar StrLower(PAnsiChar Str);
PWideChar StrLower(PWideChar Str);

StrLower converts Str to lowercase and returns Str.

Note: If the source string contains international characters, use AnsiStrLower instead. If the source string is an AnsiString (long string), use LowerCase (or AnsiLowerCase) instead.
 

C++ Examples: 

 

/*
The following example uses an edit box, two labels, and a
button on a form. When the button is clicked, the text in
the edit control is displayed in lower case in label1’s
caption and upper case in label2's caption.
*/

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Label1->Caption = StrLower(Edit1->Text.c_str());
  Label2->Caption = StrUpper(Edit1->Text.c_str());
}

 

Delphi Examples: 

{
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 lower case in the label’s
caption.
}
var
  S: array[0..20] of Char = 'A fUnNy StRiNg';

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

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

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!