Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvar
DATA1,K : string;
i:integer;
DATA1 := 'chaine "';
i := Pos(' ', K);
if i>0
then DATA1 := StringReplace(DATA1,' / ','/',[]) + Copy(K, 1, i-1)
else DATA1 := DATA1 + '?';
DATA1 := DATA1 +'"';
var
DATA1,K : string;
i:integer;
DATA1 := 'chaine "';
i := Pos(' ', K);
if i>0
then DATA1 := DATA1 +Trim( Copy(K, 1, i-1))
else DATA1 := DATA1 + '?';
DATA1 := DATA1 +'"';
function DeleteChar(Str: string; Old: Char): string;
var
PS : PByte;
PR : PByte;
begin
SetLength(Result,Length(Str));
PS := @Byte(Str[1]);
PR := @Byte(Result[1]);
while PS^ <> Byte(#0) do
begin
if PS^ = Byte(Old) then
begin
SetLength(Result,Length(Result)-1);
end
else
begin
PR^ := PS^;
Inc(PR, SizeOf(Char));
end;
Inc(PS, SizeOf(Char));
end;
end;
Edit1.text := DeleteChar('ABC / DEF / GHI',' ');
//Retourne ABC/DEF/GHI
implementation
{$R *.dfm}
function DeleteChar(Str: string; Old: Char): string;
var
PS : PByte;
PR : PByte;
begin
SetLength(Result,Length(Str));
PS := @Byte(Str[1]);
PR := @Byte(Result[1]);
while PS^ <> Byte(#0) do
begin
if PS^ = Byte(Old) then
begin
SetLength(Result,Length(Result)-1);
end
else
begin
PR^ := PS^;
Inc(PR, SizeOf(Char));
end;
Inc(PS, SizeOf(Char));
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
const
..
var
sl1-entrée, sl2-sortie: TStringList;
..
procedure traitementligne;
..
var
begin
..
..
var
DATA1,K : string;
i:integer;
DATA1 := 'chaine "';
K := DeleteChar(K,' ');
i := Pos(' ', K);
if i>0
then DATA1 + Copy(K, 1, i-1)
else DATA1 := DATA1 + '?';
DATA1 := DATA1 +'"';
..
..