From 27f5357c45d17482323eb161578d60dc79d255b0 Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 22 Aug 2020 00:45:25 +0200 Subject: [PATCH] StringsHelper: +func. LastLine --- Base/JPL.TStringsHelper.pas | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Base/JPL.TStringsHelper.pas b/Base/JPL.TStringsHelper.pas index 574224a..31f87ba 100644 --- a/Base/JPL.TStringsHelper.pas +++ b/Base/JPL.TStringsHelper.pas @@ -10,6 +10,8 @@ interface type + { TStringsHelper } + TStringsHelper = class helper for TStrings procedure TrimAllLines; procedure RemoveEmptyLines; @@ -18,6 +20,8 @@ TStringsHelper = class helper for TStrings // Warning! Use only for lists with a relatively small number of lines (up to several thousand) // With larger lists it is very slow! procedure RemoveDuplicatesWithoutSorting(IgnoreCase: Boolean = False); + + function LastLine: string; end; @@ -124,5 +128,12 @@ procedure TStringsHelper.RemoveDuplicatesWithoutSorting(IgnoreCase: Boolean); end; end; +function TStringsHelper.LastLine: string; +begin + Result := ''; + if Count = 0 then Exit; + Result := Strings[Count - 1]; +end; + end.