RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.StrUpper Function

Returns a string in upper case.

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

StrUpper converts Str to uppercase and returns Str.

Note: If the source string contains international characters, use AnsiStrUpper instead. If the source string is an AnsiString (long string), use UpperCase (or AnsiUpperCase) 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!