(Gast)
n/a Beiträge
|
AW: ShellExecute Problem mit zweitem Parameter
7. Jan 2017, 20:43
Zwei Funktionen zur Auswahl:
Delphi-Quellcode:
function RemoveSpaces( const s: string): string;
var
len, p: integer;
pc: PChar;
const
WhiteSpace = [#0, #9, #10, #13, #32];
begin
len := Length(s);
SetLength(Result, len);
pc := @s[1];
p := 0;
while len > 0 do
begin
if not (pc^ in WhiteSpace) then
begin
inc(p);
Result[p] := pc^;
end;
inc(pc);
dec(len);
end;
SetLength(Result, p);
end;
function DeleteSpaces(Str: string): string;
var i: Integer;
begin
i:=0;
while i<=Length(Str) do
if Str[i]=' ' then Delete(Str, i, 1)
else Inc(i);
Result:=Str;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit2.text:= RemoveSpaces(Edit1.text);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit2.text:= DeleteSpaces(Edit1.text);
end;
|
|
Zitat
|