1 pièce(s) jointe(s)
La procédure UTF8Insert() de l'unité LazUTF8 semble ne pas fonctionner
Bonjour :D .
En suivant les conseils reçus dans un récent topic, qui m'encourageaient à migrer vers l'UTF-8, j'ai constaté un petit problème lors de l'utilisation de la procedure
Code:
1 2 3 4 5 6 7 8 9 10
|
procedure UTF8Insert(const source: UTF8String; var s: UTF8string;
StartCharIndex: PtrInt);
var
StartBytePos: PChar;
begin
StartBytePos:=UTF8CharStart(PChar(s),length(s),StartCharIndex-1);
if StartBytePos <> nil then
Insert(source, s, StartBytePos-PChar(s)+1);
end; |
de l'unité LazUTF8. Apparemment, elle ne fonctionne pas.
J'ai fait un petit test avec les procédures insert et delete de cette unité, et delete fonctionne bien quant à lui.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
procedure TFBase.BtnInsererClick(Sender: TObject);
var
chaine1, chaine2: UTF8String;
begin
chaine1:=LEInitial.Caption;
chaine2:=LEInsert.Caption;
UTF8Insert(chaine1, chaine2, SEPosition.Value);
STResultat.Caption:=chaine1;
end;
procedure TFBase.BtnOterClick(Sender: TObject);
var
chaine: UTF8String;
begin
chaine:=LEInitial.Caption;
UTF8Delete(chaine, SEPosition.Value, SELongueur.Value);
STResultat.Caption:=chaine;
end; |
Pièce jointe 378263
Est-ce la procédure qui pose problème ou mon code?
Merci pour vos avis,
amicalement,
naute.