diff options
author | Erich Eckner <git@eckner.net> | 2015-11-13 13:50:03 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2015-11-13 14:34:58 +0100 |
commit | 741166f4b077ca8067611ab933fe0289d60d00cd (patch) | |
tree | f8ef1a76e909e4e4fbcadc41515186a0854b94a5 | |
parent | 21c9c0d09c62b2c756cc29c905717b3f0d55bbac (diff) | |
download | units-741166f4b077ca8067611ab933fe0289d60d00cd.tar.xz |
Intervallausrollen neu in lowlevelunit.pas
-rw-r--r-- | lowlevelunit.pas | 14 | ||||
-rw-r--r-- | mystringlistunit.pas | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas index 7115952..27d7d85 100644 --- a/lowlevelunit.pas +++ b/lowlevelunit.pas @@ -93,6 +93,7 @@ function mirrorBits(w: word): word; overload; function mirrorBits(b: byte): byte; overload; function zusammenfassen(s1,s2: string): string; +function intervallAusrollen(s: string): string; var base64Chars: array[0..63] of char; @@ -815,6 +816,19 @@ begin else raise exception.create('Ich kann '''+s1+''' und '''+s2+''' nicht zusammenfassen!'); end; +function intervallAusrollen(s: string): string; +var + i: longint; +begin + i:=strtoint(erstesArgument(s,'..')); + result:=''; + while i<=strtoint(s) do begin + result:=result+' '+myinttostr(i,length(s),'0'); + inc(i); + end; + result:=trim(result); +end; + var b: byte; begin diff --git a/mystringlistunit.pas b/mystringlistunit.pas index 9693fca..65f5c36 100644 --- a/mystringlistunit.pas +++ b/mystringlistunit.pas @@ -334,6 +334,15 @@ begin end; delete(i); + u:=s; + s:=''; + while length(u)>0 do begin + v:=erstesArgument(u); + if pos('..',v)<>0 then v:=intervallAusrollen(v); + s:=s+' '+v; + end; + s:=trim(s); + while length(s)>0 do begin // Schleifenzähler laufen lassen u:=erstesArgument(s); for j:=0 to SchleifenInhalt.Count-1 do begin // Schleifenkörper ... |