[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
StringSplit
This function returns the p-th part of a string, separated by the separator parameter. This turns the Source-string into a 0-indexed array of substrings.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
StringSplit
This function returns the p-th part of a string, separated by the separator parameter. This turns the Source-string into a 0-indexed array of substrings.
function StringSplit(Source: string; p: integer; separator: char): string;
var
i: integer;
s,s1: string;
begin
s:= Source + separator;
for i := 0 to p do begin
s1 := Copy(s, 1, Pos(separator, s)-1);
s := Copy(s, Pos(separator, s)+1, Length(Source));
end;
Result := s1;
end;
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
