如何将像"09335887170"这样的字符串转换为整数?这是我尝试过的:
string a = "09335887170";
int myInt;
bool isValid = int.TryParse(a, out myInt); // it returns false in this case
if (isValid)
{
int plusOne = myInt + 1;
MessageBox.Show(plusOne.ToString());
}
MessageBox.Show(a);
int stringToInt = Convert.ToInt32("09335887170"); // it returns nothing with no error
MessageBox.Show((stringToInt + 1).ToString());
int test = int.Parse(a); //it has type convertion error
MessageBox.Show((test + 1).ToString());
Run Code Online (Sandbox Code Playgroud) 如您所知,Codeigniter是一个很棒的PHP框架,我正在尝试创建自己的框架.这是一个问题.我非常喜欢$data
Codeigniter中的功能,我希望在我的框架中实现它.问题是,它是如何工作的.这是它的作用:
你做一个像这样的数组:
$data['title']= 'My Name';
Run Code Online (Sandbox Code Playgroud)然后你可以在视图中使用这个变量:
$title ;
Run Code Online (Sandbox Code Playgroud)我怎样才能制作变量$data
?
我正在尝试从注册表项中获取 reg_binary 作为字符串。
这是我的功能
function ReadBinString(key: string; AttrName: string): string;
var
ReadStr: TRegistry;
begin
// Result := '';
ReadStr := TRegistry.Create(KEY_WRITE OR KEY_WOW64_64KEY);
ReadStr.RootKey := HKEY_LOCAL_MACHINE;
if ReadStr.OpenKey(key, true) then
begin
Result := ReadStr.GetDataAsString(AttrName);
end;
ReadStr.CloseKey;
ReadStr.Free;
end;
Run Code Online (Sandbox Code Playgroud)
这是我的注册表项 Export :
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\ZES\ACINFO]
"iamthere"=dword:00000001
"ArrayOrder"=hex:4d,79,45,78,63,6c,75,64,65
Run Code Online (Sandbox Code Playgroud)
问题是,该函数返回空字符串
我什至尝试以管理员身份运行以确保它不是权限。
有什么帮助吗?