Frement
2009-09-30 23:50:35
Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.
I dont know if there is this kind of function, but i still made it. Dont know if this is any use at all :P
I dont know if there is this kind of function, but i still made it. Dont know if this is any use at all :P
program ExplodeFunction;
type ExplodeArray = array[1..65536] of String;
var arr: ExplodeArray;
function explode( delimeter, str: String ): ExplodeArray;
var i, l, a: Integer;
r: ExplodeArray;
s: Char;
p: String;
begin
l := Length( str );
a := 1;
p := '';
for i := 1 to l do
begin
s := StrGet( str, i );
if ( s = delimeter ) then
begin
r[a] := p;
p := '';
a := a + 1;
end else
begin
p := p + s;
end;
end;
r[a] := p;
Result := r;
end;
begin
arr := explode( '.', 'lol.asd.fail' );
Writeln( arr[3] );
end.