0

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 ?

Vlark.Lopin
  • 762
  • 10
  • 21

1 Answers1

1

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

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490