summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-03-19 15:46:49 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-03-19 15:46:49 +0200
commit8b9a113206dcea4d75cf3177058a7eeaa17b8dd0 (patch)
tree6a5989ced465b4dfbcb767a66de71e08cf13cb4c /src
parent2e5e0b34db113e177bf5994ff7a6e2cbcd1d339e (diff)
downloadfpGUI-8b9a113206dcea4d75cf3177058a7eeaa17b8dd0.tar.xz
New convenience string functions.
* fpgAppendPathDelim() * fpgRemovePathDelim()
Diffstat (limited to 'src')
-rw-r--r--src/corelib/fpg_stringutils.pas17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/fpg_stringutils.pas b/src/corelib/fpg_stringutils.pas
index 2253c149..f97f1b61 100644
--- a/src/corelib/fpg_stringutils.pas
+++ b/src/corelib/fpg_stringutils.pas
@@ -46,6 +46,8 @@ procedure Delete8(var S: string; Index, Size: integer);
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;
implementation
@@ -317,6 +319,21 @@ begin
Result := UTF8Copy(s, Index, 1);
end;
+function fpgAppendPathDelim(const Path: TfpgString): TfpgString;
+begin
+ if (Path <> '') and (Path[Length(Path)] <> PathDelim) then
+ Result := Path + PathDelim
+ else
+ Result := Path;
+end;
+
+function fpgRemovePathDelim(const Path: TfpgString): TfpgString;
+begin
+ if (Path <> '') and (Path[Length(Path)] = PathDelim) then
+ Result := LeftStr(Path, Length(Path)-1)
+ else
+ Result := Path;
+end;
end.