diff options
author | Erich Eckner <git@eckner.net> | 2017-09-25 10:16:52 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-09-25 10:16:52 +0200 |
commit | d7b4b3c06768e9839c0146d768415cb79b45384b (patch) | |
tree | edb8bd3e97c2e70d6d194b9c909cfb60d466d941 /mystringlistunit.pas | |
parent | bb5c53c82761f4a68aeb6f95935eac11b1d77a07 (diff) | |
download | units-d7b4b3c06768e9839c0146d768415cb79b45384b.tar.xz |
mystringlistunit.pas: tMyStringList.splitLines neu
Diffstat (limited to 'mystringlistunit.pas')
-rw-r--r-- | mystringlistunit.pas | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mystringlistunit.pas b/mystringlistunit.pas index 48bde05..381e5dc 100644 --- a/mystringlistunit.pas +++ b/mystringlistunit.pas @@ -39,6 +39,7 @@ type procedure insert(index: longint; const s: ansiString); override; function unfoldMacros(kvs: tKnownValues = nil; cbgv: tCallBackGetValue = nil): boolean; procedure subst(regex,ersatz: string); + procedure splitLines(before,after: string); procedure dump(pro: tProtokollant; prefix: string); procedure nichtInSubRoutine(s: string); procedure addWithLineBreaks(s: string); @@ -596,6 +597,31 @@ begin re.free; end; +procedure tMyStringList.splitLines(before,after: string); +var + i: longint; + s: string; +begin + i:=0; + while i<count do begin + while (before<>'') and (pos(before,rightStr(self[i],length(self[i])-1))>1) do begin + insert(i,leftStr(self[i],1+pos(before,rightStr(self[i],length(self[i])-1))-1)); + inc(i); + self[i]:=rightStr(self[i],length(self[i])-length(self[i-1])); + end; + inc(i); + end; + i:=0; + while i<count do begin + while (after<>'') and (pos(after,leftStr(self[i],length(self[i])-1))>1) do begin + insert(i,leftStr(self[i],pos(after,leftStr(self[i],length(self[i])-1))-1+length(after))); + inc(i); + self[i]:=rightStr(self[i],length(self[i])-length(self[i-1])); + end; + inc(i); + end; +end; + procedure tMyStringList.dump(pro: tProtokollant; prefix: string); var i: longint; |