SCAR Code:
var
m: String;
tsb: TStringArray;
i: Integer;
begin
m := 'omfg dude this is sick';
SetArrayLength(tsb, 9);
tsb := Explode(' ', m);
WriteLn(inttostr(length(tsb)));
WriteLn('ex1:' + tsb[0]+'');
WriteLn('ex2:' + tsb[1]+'');
WriteLn('ex1:' + tsb[3]+'');
WriteLn('ex2:' + tsb[4]+'');
for i := 0 to High(tsb) do
begin
WriteLn('EX:'+tsb[i]);
end;
end.
your loop is High of ts, not tsb.
You never use b.
Code:
Successfully compiled (45 ms)
5
ex1:omfg
ex2:dude
ex1:is
ex2:sick
EX:omfg
EX:dude
EX:this
EX:is
EX:sick
Successfully executed
Returned it all for me (that you told it too).
Add WriteLn('ex?:' + tsb[2]+''); you get. <- You forgot [2]
Code:
Successfully compiled (45 ms)
5
ex1:omfg
ex2:dude
ex?:this
ex1:is
ex2:sick
EX:omfg
EX:dude
EX:this
EX:is
EX:sick
Successfully executed
SCAR Code:
var
m: String;
tsb: TStringArray;
i: Integer;
begin
m := 'omfg dude this is sick';
SetArrayLength(tsb, 9);
tsb := Explode(' ', m);
WriteLn(inttostr(Length(tsb)));
WriteLn('ex1:' + tsb[0]);
WriteLn('ex2:' + tsb[1]);
WriteLn('ex?:' + tsb[2]);
WriteLn('ex1:' + tsb[3]);
WriteLn('ex2:' + tsb[4]);
for i := 0 to High(tsb) do
begin
WriteLn('EX:'+tsb[i]);
end;
end.