idhttp get string and convert it to Integer

421 views Asked by At

i am trying to get string from url and convert it to integer

i am doing something like this

var
stringtoget : string;
stringint : integer;

stringtoget := IdHTTP1.Get('http://url/text.txt');

stringint := strToint(stringtoget );

But i get the following exception

Project Project1.exe raised exception class EConvertError with message ''26655 ' is not a valid integer value'.

any idea what is the problem ?

1

There are 1 answers

1
David Heffernan On BEST ANSWER

There's a trailing space on the string. That can be seen in the error message. Remove it with Trim before converting.