diff options
author | Erich Eckner <git@eckner.net> | 2018-02-19 09:36:06 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-02-19 09:36:06 +0100 |
commit | fd7cb3056efe467d5172455fb5451e4f5a10f380 (patch) | |
tree | 5c5ba8c342788ba46535d51a0c983c7b03e3c348 | |
parent | d8636ed7a14841b5657f74d3b219125a7174f525 (diff) | |
download | units-fd7cb3056efe467d5172455fb5451e4f5a10f380.tar.xz |
lowlevelunit.pas: vergleicheStrings neu
-rw-r--r-- | lowlevelunit.pas | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas index c6cfa1b..f30ca0b 100644 --- a/lowlevelunit.pas +++ b/lowlevelunit.pas @@ -151,6 +151,7 @@ procedure readAnAndorString(var f: file; out s: string; const len: int64; checkE procedure readAnAndorString(var f: file; out s: string; checkEOL: boolean); overload; procedure splitStrToInt(s: string; out ia: tLongintArray); +function vergleicheStrings(s1,s2: string): integer; var base64Chars: array[0..63] of char; @@ -1280,6 +1281,34 @@ begin end; end; +function vergleicheStrings(s1,s2: string): integer; +var + i: longint; +begin + result:=0; + i:=1; + while (i<=length(s1)) and (i<=length(s2)) do begin + if s1[i]<s2[i] then begin + result:=-1; + exit; + end; + if s1[i]>s2[i] then begin + result:=1; + exit; + end; + inc(i); + end; + if length(s1)<length(s2) then begin + result:=-1; + exit; + end; + if length(s1)>length(s2) then begin + result:=1; + exit; + end; + result:=0; +end; + var b: byte; |