The function EndsText performs the same as the function EndsStr, but without the sensitivity to case.

EndsText determines whether the substring ASubText appears at the end of the string AText.

If ASubText matches the trailing end of AText, then the result is True, otherwise a False is returned.

For a function that performs the same role but does not take case sensitivity into account, please review the EndsStr routine.

Declaration: Function EndsText(const ASubText, AText : string) : Boolean;

Examples that also use the BoolToStr function are below. Please review BoolToStr for more information.

procedure OnMapEvent(var Value:Variant);
var
TheText, FullText, Which : string;
BoYN : boolean;
begin
FullText := 'The Archbishop of Canterbury was in attendance.';
 
TheText := 'attendance.';
BoYN := EndsText(TheText, FullText);
Which := BoolToStr(BoYN, true);
LogInfo(Which); //1st test is true
 
TheText := 'was in attendance.';
BoYN := EndsText(TheText, FullText);
Which := BoolToStr(BoYN, true);
LogInfo(Which); //2nd test is true
 
TheText := 'Attendance.';
BoYN := EndsText(TheText, FullText);
Which := BoolToStr(BoYN, true);
LogInfo(Which); //3rd test is true - ignores case
TheText := 'attendance';
BoYN := EndsText(TheText, FullText);
Which := BoolToStr(BoYN, true);
LogInfo(Which); //4th test is false due to no full-stop
TheText := 'absent.';
BoYN := EndsText(TheText, FullText);
Which := BoolToStr(BoYN, true);
LogInfo(Which); //5th test is false due to ABSENT
 
end;