diff options
-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; |