RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.UpperCase Function

Returns a copy of a string in uppercase.

Pascal
function UpperCase(const S: string): string; overload;
function UpperCase(const S: string; LocaleOptions: TLocaleOptions): string; overload;
C++
AnsiString UpperCase(const AnsiString S);
AnsiString UpperCase(const AnsiString S, TLocaleOptions LocaleOptions);

SysUtils

UpperCase returns a copy of the string S, with the same text but with all 7-bit ASCII characters between 'a' and 'z' converted to uppercase. To convert 8-bit international characters, use AnsiUpperCase instead.  

C++ Examples: 

 

/*
This example uses a list box and a button on a form. Use the
Items property editor in the Object Inspector to enter a
list of strings in the list box. When the application runs
and the button is clicked, the strings in the list box
become uppercase.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  for (int I = 0; I < ListBox1->Items->Count; I++)
    ListBox1->Items->Strings[I] = UpperCase(ListBox1->Items->Strings[I]);
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  ListBox1->Items->Add("Not");
  ListBox1->Items->Add("In");
  ListBox1->Items->Add("Alphabetical");
  ListBox1->Items->Add("Order");
}

 

Delphi Examples: 

{
This example uses a list box and a button on a form. Use the
Items property editor in the Object Inspector to enter a
list of strings in the list box. When the application runs
and the button is clicked, the strings in the list box
become uppercase.
}
procedure TForm1.Button1Click(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to ListBox1.Items.Count -1 do
    ListBox1.Items[I] := SysUtils.UpperCase(ListBox1.Items[I]);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ListBox1.Items.Add('Not');
  Listbox1.Items.Add('In');
  ListBox1.Items.Add('Alphabetical');
  ListBox1.Items.Add('Order');
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!