Delphi Basics
UpCase
Function
Convert a Char value to upper case System unit
 function UpCase ( Letter : Char ) : Char;
Description
The UpCase function converts a single Letter character to upper case.
 
It only works on the standard 'a'..'z' letters.
 
It returns Letter unchanged if already upper case or non alphabetic.
Notes
Warning : this command is restricted to single characters, and does not handle International characters. Better to use AnsiupperCase instead.
Related commands
AnsiLowerCase Change upper case characters in a string to lower case
AnsiUpperCase Change lower case characters in a string to upper case
 
Example code : Convert g to G
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  // The System unit does not need to be defined
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  lower, upper : char;

begin
  // Convert a lower case letter to upper case
  lower := 'g';
  upper := UpCase(lower);

  // Display these letters
  ShowMessage('lower = '+lower+' upper = '+upper);
end;
 
end.
Hide full unit code
   lower = g upper = G
 
 
© CodeGear 2006 - 2007. All rights reserved.  |  Home Page