Sources
Delphi Russian Knowledge Base
DRKB - база знаний по Дельфи в рунете, составленная Виталием Невзоровым

String -> Array

01.01.2007

Вариант 1:

Procedure AssignFixedString( Var FixedStr: Array of Char; Const S: String );
Var
  maxlen: Integer;
Begin
  maxlen := Succ( High( FixedStr ) - Low( FixedStr ));
  FillChar( FixedStr, maxlen, ' ' ); { blank fixed string }
  If Length(S) > maxlen Then
    Move( S[1], FixedStr, maxlen )
  Else
    Move( S[1], FixedStr, Length(S));
End;

Вариант 2:

Source: DelphiWorld 6.0 https://delphiworld.narod.ru/

function StrToArrays(str, r: string; out Temp: TStrings): Boolean;
var
  j: integer;
begin
  if temp <> nil then
  begin
    temp.Clear;
    while str <> '' do
    begin
      j := Pos(r,str);
      if j=0 then
        j := Length(str) + 1;
      temp.Add(Copy(Str,1,j-1));
      Delete(Str,1,j+length(r)-1);
    end;
    Result:=True;
  end
  else
    Result:=False;
end;
Previous page:
Сохранение и загрузка двумерного динамического масива
Top:
DRKB
Next page:
Как поместить двумерный массив в TImage?