0 Members and 1 Guest are viewing this topic.
function ContainsNum(Source,Test: string): integer;var temp: integer;beginresult := 0;repeat temp := pos(test,source); if temp = 0 then exit; result := result + 1; delete(source,1,temp); until temp = 0;end;
lines := containsnum(readfile(MYFILE),#13+#10);
vari: integer;j: array of string;function explode(const Delimiter: string; Source: string): array of string;var Position, DelLength, ResLength: integer;begin DelLength := Length(Delimiter); Source := Source + Delimiter; repeat Position := Pos(Delimiter, Source); SetArrayLength(Result, ResLength + 1); Result[ResLength] := Copy(Source, 1, Position - 1); ResLength := ResLength + 1; Delete(Source, 1, Position + DelLength - 1); until (Position = 0); SetArrayLength(Result, ResLength - 1);end;function OnPlayerCommand(ID: integer; Text: string): boolean;begin if text = '/test' then begin j := explode(chr(13)+chr(10),ReadFile('test.txt')); for i := 0 to GetArrayLength(j)-2 do begin WriteConsole(0,j[i],$ffffff); end; end;end;
-2
GetArrayLength(J)
j: array of string;
j: array [1..100] of string;
OK thanks i get it now.In HackTank's ContainsNum/Split/Explode functions, what does Delete(x,x,x) actually do?