简体   繁体   English

如何在Oxygene中将字符串转换为整数

[英]How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; 在Delphi中,有一个函数StrToInt()将字符串转换为整数值。 there is also IntToStr(), which does the reverse. 还有IntToStr(),它的作用相反。 These functions doesn't appear to be part of Oxygene, and I can't find a reference to something that can do that. 这些功能似乎不是Oxygene的一部分,而且我找不到能够做到这一点的参考。 How can it be done? 如何做呢?

You can use the Int32.Parse function 您可以使用Int32.Parse函数

try this 尝试这个

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

.Parse is pretty richly supported for multiple types. .Parse非常支持多种类型。

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 . RRUZ的答案是正确的,但是如果您不能对在Delphi win32中曾经使用过的所有函数和类说再见,您可以看看ShineOn It's an open source library written in Delphi Prism to port Delphi win32 functions and classes to .Net. 这是一个用Delphi Prism编写的开源库,用于将Delphi win32函数和类移植到.Net。 Not surprisingly it also contains IntToStr and StrToInt . 毫不奇怪,它还包含IntToStr和StrToInt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM