diff options
author | Erich Eckner <git@eckner.net> | 2017-03-25 16:22:58 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-03-25 16:22:58 +0100 |
commit | 4ad8b1023f4dd6a2d8132633c461a9e05cad0b2c (patch) | |
tree | e68f7bb231c383f5686bc551c9e1b4d6a605faf0 /lowlevelunit.pas | |
parent | 33a5e61e3730dac181226cac5a3a33393d1eb7bf (diff) | |
download | units-4ad8b1023f4dd6a2d8132633c461a9e05cad0b2c.tar.xz |
lowlevelunit: umbrechen neu
Diffstat (limited to 'lowlevelunit.pas')
-rw-r--r-- | lowlevelunit.pas | 24 |
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; |