Home  |  Delphi .net Home  |  system.String  |  EndsWith Method
EndsWith  
Method  
Determines if a string ends with a specified string
String Class
system NameSpace
CF1.  Function EndsWith ( Value : String; ) : Boolean;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns true if the end of a string matches the Value specified string.
 
It is case sensitive.
Microsoft MSDN Links
system
system.String
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  strA : String;

begin
  strA := 'ABCDEF';

  Console.WriteLine('strA = ' + strA);

  if strA.EndsWith('DEF')
  then Console.WriteLine('strA ends with DEF')
  else Console.WriteLine('strA does not end with DEF');

  if strA.EndsWith('def')
  then Console.WriteLine('strA ends with def')
  else Console.WriteLine('strA does not end with def');

  Console.ReadLine;
end.
Show full unit code
  strA = ABCDEF
  strA ends with DEF
  strA does not end with def
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author