summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2015-10-22 14:24:51 +0200
committerErich Eckner <git@eckner.net>2015-10-22 14:24:51 +0200
commitb81ccffdcc682c4877b53ebe5c85fad2cc704625 (patch)
tree293747420c9443b2ba3b7b1cbbb1d6ea0d1b1c5a
parentec0952e17b12fd5081e8783264b0b3c6e34a2400 (diff)
downloadunits-b81ccffdcc682c4877b53ebe5c85fad2cc704625.tar.xz
istGanzZahl neu in matheunit.pas
-rw-r--r--matheunit.pas12
1 files changed, 12 insertions, 0 deletions
diff --git a/matheunit.pas b/matheunit.pas
index 710a46b..ed9244f 100644
--- a/matheunit.pas
+++ b/matheunit.pas
@@ -39,6 +39,7 @@ function cmpStr(s1,s2: string): longint;
function mitte(s1,s2: string): string;
function myFloatToStr(x: extended): string;
function myStrToFloat(s: string): extended;
+function istGanzZahl(s: string): boolean;
procedure copyArray(i: tExtPointArray; out o: tExtPointArray); overload;
procedure copyArray(i: tLongintArray; out o: tLongintArray); overload;
procedure copyArray(i: tExtendedArray; out o: tExtendedArray); overload;
@@ -321,6 +322,17 @@ begin
result:=-result;
end;
+function istGanzZahl(s: string): boolean;
+var
+ i: longint;
+begin
+ result:=length(s)>0;
+ result:=result and (length(s) > byte(s[1] in ['-','+']));
+ if result then
+ for i:=byte(s[1] in ['-','+'])+1 to length(s) do
+ result:=result and (s[i] in ['0'..'9']);
+end;
+
procedure copyArray(i: tExtPointArray; out o: tExtPointArray);
var
j: longint;