Ihave a value in a TstringArray like this
The TStringArray is OBST
so
OBST[i][0] has a value from an ini of: 3235182,3244322 and are colours
how can i turn this into the TIntegerArray that FindColorEx expects ?![]()
Ihave a value in a TstringArray like this
The TStringArray is OBST
so
OBST[i][0] has a value from an ini of: 3235182,3244322 and are colours
how can i turn this into the TIntegerArray that FindColorEx expects ?![]()
Why don't you just declare it a TIntegerArray from the start and populate it using StrToInt? :P
You'll have to create a whole new one for this.
Simba Code:var
OldArr : TStringArray;
NewArr : TIntegerArray;
i, h : integer;
begin
OldArr := ['12', '34', '56', '78'];
h := high(OldArr);
SetArrayLength(NewArr, h + 1);
for i := 0 to h do
NewArr[i] := StrToIntDef(OldArr[i], -1);
OldArr := [];
end.
Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
Perfect thanks
Can't you use TVariantArray for this?
~Home
Variants have types. So it remains as a string. (unless I'm mistaken)
Best thing to do would be read it in using intToStr straight away, and bypass the string array completely (as sex said).
Ah look at that it does workHow awesome!
I was thinking Java. You can store anything in an 'Object' (equivalent of Variant), but it keeps its type (so you can't add strings to ints or anything).Code:program new; var ReqArr : TVariantArray; i, h : integer; begin ReqArr := ['123', '343', '563', '78']; For i := 0 to High(ReqArr) do Writeln(toStr(ReqArr[i] + 1)); end.
Useful.
There are currently 1 users browsing this thread. (0 members and 1 guests)