views:

940

answers:

3

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn't appear to be part of Delphi Prism, and I can't find a reference to something that can do that. How can it be done?

+8  A: 

You can use the Int32.Parse function

try this

function StrToInt(S: String): Integer;
begin
  Result:=Int32.Parse(S);
end;

.Parse is pretty richly supported for multiple types.

RRUZ
You can also use Int32.TryParse(S, out intVariable) which returns a boolean indicating whether parsing the string into an integer was successful.
Sebastian P.R. Gingter
+4  A: 

RRUZ has the correct answer, but if you can't say good-bye to all the functions and classes you where used to in Delphi win32 you could take a look at ShineOn. It's an open source library written in Delphi Prism to port Delphi win32 functions and classes to .Net. Not surprisingly it also contains IntToStr and StrToInt.

Lars Truijens
A: 

how can i install shineON please? I download it but can't use? please help me.

mehdi
You should post follow-up questions as a separate thread, notas an answer. After all, it doesn't really answer *this*question. Also more people would see it and try to answer if you post it asyour own question. Make sure to add as many details as possible, so that people can give useful answers.
sth