function GetStr(str : string; nCount : Integer): string; var I ,Sum: Integer; begin if str = '' then begin Result := ''; Exit; end; if Length(str) < nCount then begin Result := trim(str); Exit; end; Sum := 0; for I := 1 to Length(str)-1 do begin if str[I] <> ' ' then begin Result := Result + str[I]; inc(Sum); if Sum = nCount then Exit; end; end; end;
function GetStr(str : string; nCount : Integer): string; var I ,Sum: Integer; begin if str = '' then begin Result := ''; Exit; end; if Length(str) < nCount then begin Result := trim(str); Exit; end; Sum := 0; for I := 1 to Length(str) do begin if str[I] <> ' ' then begin Result := Result + str[I]; inc(Sum); if Sum = nCount then Exit; end; end; end;
str := Edit1.Text;
str := StringReplace(str,' ','');Edit2.Text:=LeftStr(str, 4);
function GetStr(str : string; nCount : Integer): string;
var
I ,Sum: Integer;
begin
if str = '' then
begin
Result := '';
Exit;
end;
if Length(str) < nCount then
begin
Result := trim(str);
Exit;
end;
Sum := 0;
for I := 1 to Length(str)-1 do
begin
if str[I] <> ' ' then
begin
Result := Result + str[I];
inc(Sum);
if Sum = nCount then Exit;
end;
end;
end;
function GetStr(str : string; nCount : Integer): string;
var
I ,Sum: Integer;
begin
if str = '' then
begin
Result := '';
Exit;
end;
if Length(str) < nCount then
begin
Result := trim(str);
Exit;
end;
Sum := 0;
for I := 1 to Length(str) do
begin
if str[I] <> ' ' then
begin
Result := Result + str[I];
inc(Sum);
if Sum = nCount then Exit;
end;
end;
end;