Skip to content

TitleCase ​

The function TitleCase forces the first character of every major word within the specified string aString to uppercase, leaving the remaining words in lowercase.

Declaration: Function TitleCase(const aString : String) : String');

Here are some examples.

pascal
procedure OnMapEvent(var Value:Variant);
Var
  Str0, Str1 : string;
begin
 //Returns 'This Manual Contains Several Different Kinds of Information About King Charles:'
  Str1 := TitleCase('THIS MANUAL CONTAINS SEVERAL DIFFERENT KINDS OF INFORMATION ABOUT KING CHARLES:');
  LogInfo(Str1);

 //Returns 'In the Auckland Show, 76 Trombones Lead the Big Parade!'
  Str1 := TitleCase('in the auckland show, 76 trombones lead the big parade!');
  LogInfo(Str1);

 //Returns 'I Counted 15 Asterisks (*) and a Bassoon, but the Manager Sarah Counted 10 Ampersands (&).'
  Str0 := 'I counted 15 asterisks (*), by the manager sarah counted 10 ampersands (&).'
  Str1 := TitleCase(Str0);
  LogInfo(Str1);

end;