Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {*******************************************************************************
- function srl_Explode(str, del: string): TStringArray;
- By: mixster
- Description: Explodes a string into a TStringArray, seperated by del.
- *******************************************************************************}
- function srl_Explode(str, del: string): TStringArray;
- var
- i, l, dL: Integer;
- begin
- {$IFDEF SCAR320_UP}
- Result := Explode(del, str);
- {$ELSE}
- i := 0;
- l := -1;
- SetLength(Result, 0);
- if (str = '') then
- Exit;
- dL := Length(del) - 1;
- repeat
- Inc(l);
- SetLength(Result, l + 1);
- i := Pos(del, str);
- if i <= 0 then
- Break;
- Result[l] := Copy(str, 1, i - 1);
- Delete(str, 1, i + dL);
- until false
- Result[l] := Copy(str, 1, Length(str));
- {$ENDIF}
- end;
- {*******************************************************************************
- function srl_Implode(Pieces: TStringArray; Separator: string): string;
- By: ZephyrsFury
- Description: Combines Pieces in a single string separated by a Separator.
- *******************************************************************************}
- function srl_Implode(Pieces: TStringArray; Glue: string): string;
- var
- II, H: Integer;
- begin
- {$IFDEF SCAR320_UP}
- Result := Implode(glue, pieces);
- {$ELSE}
- H := High(Pieces);
- if (H < 0) then Exit;
- Result := Pieces[0];
- if H > 0 then
- for II := 1 to H do
- Result := Result + Glue + Pieces[II];
- {$ENDIF}
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement