Inno Setup convert string in array to boolean
从 Inno Setup 开始,从存储在数组中的逗号分隔字符串创建数组,我有一个二维(四列)数组
因此,问题是如何将这些值转换为
1 2 3 4 5 6 7 8 9 10 11 12 13 | CheckListBox := TNewCheckListBox.Create(SelectRemotesPage); with CheckListBox do begin Parent := SelectRemotesPage.Surface; Left := ScaleX(0); Top := ScaleY(50); Width := ScaleX(250); Height := ScaleY(153); for intIndex := 0 to intNumberRemotes - 1 do begin AddCheckBox(RemoteDetailsLines[intIndex][1], RemoteDetailsLines[intIndex][2], 0, RemoteDetailsLines[intIndex][3], True, False, False, Nil); end; end; |
对于这个简单的情况,使用:
1 | AddCheckBox(..., (RemoteDetailsLines[intIndex][3] <> '0'), ...); |
比较运算符
更健壮的解决方案是:
1 | AddCheckBox(..., (StrToIntDef(RemoteDetailsLines[intIndex][3], 0) <> 0), ...); |
将字符串转换为