I can't convert this string to numerical value. Is there any way to do it ?

error - '44849848974575' is not a valid integer value

........

begin

showmessage(inttostr(strtoint('44849848974575' )));

end;

error - '44849848974575' is not a valid integer value

........

begin

showmessage(inttostr(strto

end;

function strtoint2(s:string):cardin

var i,len,res:word;

lame:array[1..15] of cardinal;

function mocnina(a,i:word):cardinal

var b:cardinal;

x:word;

begin

b:=a;

for x:=1 to i-1 do

begin

b:=b*a;

end;

result:=b;

end;

begin

for i:=1 to 15 do // rad

begin

lame[i]:=(mocnina(10,i)) div 10;

end;

len:=length(s);

res:=0;

for i:=1 to len do

begin

res:=res+(lame[i]*strtoint

end;

result:=res;

end;

function strtoint2(s:string):int64;

var i,len:longint;

res:int64;

lame:array[1..30] of int64;

function exp(x,n:int64):int64;

var y:int64;

i:longint;

begin

y:=x;

for i:=1 to n-1 do

begin

y:=y*x;

end;

result:=y;

end;

begin

for i:=1 to 30 do

begin

lame[i]:=(exp(10,i)) div 10;

end;

len:=length(s); res:=0;

for i:=1 to len do

begin

res:=res+(lame[i]*strtoint

end;

result:=res;

end;

function inttostr2(n:int64):string;

var i:longint;

point,help:int64;

res:string;

stop:boolean;

lame:array[1..30] of int64;

function exp(x,n:int64):int64;

var y:int64;

i:longint;

begin

y:=x;

for i:=1 to n-1 do

begin

y:=y*x;

end;

result:=y;

end;

begin

for i:=1 to 30 do

begin

lame[i]:=(exp(10,i)) div 10;

end;

stop:=false;

for i:=1 to 30 do

begin

if stop=false then

begin

if ((n / lame[i] ) >= 1) and ((n / lame[i] ) < 10) then

begin

stop:=true;

point:=i;

end;

end;

end;

res:='';

while n > 1 do

begin

res:=res+inttostr(trunc(n/

help:=((trunc (n/lame[point]))*lame[poin

n:=n-help;

dec(point);

end;

result:=res;

end;

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.