summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/fpg_stringutils.pas18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/corelib/fpg_stringutils.pas b/src/corelib/fpg_stringutils.pas
index f97f1b61..3e54e02b 100644
--- a/src/corelib/fpg_stringutils.pas
+++ b/src/corelib/fpg_stringutils.pas
@@ -48,6 +48,8 @@ procedure Insert8(const Source: string; var S: string; Index: integer);
function fpgCharAt(const s: TfpgString; Index: integer): TfpgChar;
function fpgAppendPathDelim(const Path: TfpgString): TfpgString;
function fpgRemovePathDelim(const Path: TfpgString): TfpgString;
+function fpgTrimR(const AString, ATrim: TfpgString; ACaseSensitive: boolean = false): TfpgString;
+
implementation
@@ -335,5 +337,21 @@ begin
Result := Path;
end;
+function fpgTrimR(const AString, ATrim: TfpgString; ACaseSensitive: boolean): TfpgString;
+var
+ li: integer;
+begin
+ if ACaseSensitive then
+ li := UTF8Pos(ATrim, AString)
+ else
+ li := UTF8Pos(UpperCase(ATrim), UpperCase(AString));
+
+ if li <> 0 then
+ Result := UTF8Copy(AString, 1, li - 1)
+ else
+ Result := AString;
+end;
+
+
end.