Bonjour,
voila mon solution , j'ai fait une fonction "LigneDeVirement" qui a 3 paramètre ccp, montant , nom
s : string;
exemple : S:= Lignedevirement := ('12544111',55000.00,'BENDIB YASSINE');
et le resultat sera
s= *000000000000125441110000005500000BENDIB YASSINE 1
function LigneDeVirement(Nccp : String;Montant: Real;Nom:String) : String;
var s,St,sNccp : String;MEntier : integer;
begin
s:= FormatFloat('0.00',Montant );;
s := copy(s,pos(DecimalSeparator,s)+1,2);
MEntier := trunc(Montant);
St := '*00000000' + Repeatstr('0',12-Length( epurer(Trim(Nccp)))) + epurer(Trim(Nccp));
St := St + RepeatStr('0',11-length(inttostr(mentier))) + IntToStr(MEntier)+ s;
if Length(Trim(Nom)) >= 27 then St := St + LeftStr(Trim(Nom),27)+'1'
Else St := St + nom + RepeatStr(' ',27-length(trim(nom))) + '1';
Result := st;
end;
function epurer (CCp : String):string;
Var s,s1 : string; i:integer;
Begin
s := '';
for i :=1 to length(ccp) Do
IF (CCp[i] in ['0'..'9']) Then S := S + CCp[i] ;
epurer := S;
end;
(**********************************************************************)
FUNCTION RepeatStr(ch: char; n:integer): string;
var i : integer ;
s : string;
Begin
s := '';
for i := 1 to n do s := s + ch;
result := s;
end;