function IntNumber(const str:string;var pos, val:Integer):boolean;
 var c:Char;
  npos:Integer;
 function getc:Char;
 begin
  pos:=npos;
  if pos>length(str) then c:=#0 else begin c:=str[pos];npos:=pos+1;end;
  Result:=c;
 end;
 var s:string;
 procedure hex;
 begin
  s:='$';
  if not (getc in ['0'..'9' , 'A'..'F' , 'a'..'f'] ) then abort;
  repeat s:=s+c until not (getc in['0'..'9' , 'A'..'F' , 'a'..'f']);
  val:=StrToInt(s);
 end;
 procedure bin;
 var dt:Integer;
 begin
  dt:=0;
  if not (getc in ['0'..'1' ] ) then abort;
  repeat dt:=dt*2+(ord(c)-ord('0')); until not (getc in['0'..'1' ]);
  val:=dt;
 end;
 label nxt;
begin
  npos:=pos;
 Result:=true;
try
 case getc of
 '0':case getc of
    'X','x':hex;
    'B','b':bin;
    else goto nxt;//func(0);
   end;
 '$':hex;
 '1'..'9': begin
    nxt: s:=c;
      while getc in['0'..'9'] do s:=s+c;
      val:=StrToInt(s);
     end;
 else Result:=false;
 end;
 except Result:=false;end;
end;