summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lowlevelunit.pas24
1 files changed, 24 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas
index 9d21db5..17ce8c9 100644
--- a/lowlevelunit.pas
+++ b/lowlevelunit.pas
@@ -80,6 +80,7 @@ function startetMit(start: string; var s: string): boolean;
function endetMit(ende: string; var s: string): boolean;
function trimAll(s: string): string;
function erstesArgument(var s: string; Trenner: string = ' '; trimmen: boolean = true): string; inline;
+function umbrechen(s,trenner: string; klammernBeachten: boolean = false; zeilenanfang: string = ''): string; inline;
function unEscape(s: string): string;
function mydatetimetostr(t: tDateTime): string;
function t2x2ExtendedToStr(p: t2x2Extended): string;
@@ -623,6 +624,29 @@ begin
result:=trim(result);
end;
+function umbrechen(s,trenner: string; klammernBeachten: boolean = false; zeilenanfang: string = ''): string; inline;
+var
+ i,kl: longint;
+begin
+ result:='';
+ i:=1;
+ kl:=0;
+ while i<=length(s) do begin
+ if klammernBeachten and (s[i] in ['(','[','{']) then
+ inc(kl);
+ if klammernBeachten and (s[i] in [')',']','}']) then
+ dec(kl);
+ if (kl=0) and (copy(s,i,length(trenner))=trenner) then begin
+ result:=result+#13+zeilenanfang+copy(s,1,i-1);
+ delete(s,1,i-1+length(trenner));
+ i:=0;
+ end;
+ inc(i);
+ end;
+ result:=result+#13+zeilenanfang+s;
+ delete(result,1,1+length(zeilenanfang));
+end;
+
function unEscape(s: string): string;
var
i: longint;