Hola compañeros, me gustaría colaborar como siempre con una nueva funcion, para convertir cadenas String a HTML
Código Delphi
[-]function StringToHtml(Tex:string):string;
var VarSMiTex,VarSLet,VarSTexto:string;
VarIa,VarIe,VarICon,VarI2Con:Integer;
begin
VarSMiTex:='';
VarSTexto:=StringReplace(Tex,#13#10,'[xSx]',[rfReplaceAll]);
VarIa:=Length(VarSTexto);
VarICon:=0;
VarI2Con:=0;
for VarIe := 1 to VarIa do
begin
if VarI2Con>0 then VarI2Con:=VarI2Con-1 else
begin
if Copy(VarSTexto,varie,5)='[xSx]' then
begin
VarI2Con:=4;
VarSMiTex:=VarSMiTex+'
'; end else
begin
VarSLet:=VarSTexto[varie];
if (Length(VarSLet)=1) and (VarSLet='á') then VarSLet:='á';
if (Length(VarSLet)=1) and (VarSLet='é') then VarSLet:='é';
if (Length(VarSLet)=1) and (VarSLet='í') then VarSLet:='í';
if (Length(VarSLet)=1) and (VarSLet='ó') then VarSLet:='ó';
if (Length(VarSLet)=1) and (VarSLet='ú') then VarSLet:='ú';
if (Length(VarSLet)=1) and (VarSLet='Á') then VarSLet:='Á';
if (Length(VarSLet)=1) and (VarSLet='É') then VarSLet:='É';
if (Length(VarSLet)=1) and (VarSLet='Í') then VarSLet:='Í';
if (Length(VarSLet)=1) and (VarSLet='Ó') then VarSLet:='Ó';
if (Length(VarSLet)=1) and (VarSLet='Ú') then VarSLet:='Ú';
if (Length(VarSLet)=1) and (VarSLet='ü') then VarSLet:='ü';
if (Length(VarSLet)=1) and (VarSLet='ñ') then VarSLet:='ñ';
if (Length(VarSLet)=1) and (VarSLet='Ü') then VarSLet:='Ü';
if (Length(VarSLet)=1) and (VarSLet='Ñ') then VarSLet:='Ñ';
if (Length(VarSLet)=1) and (VarSLet='¡') then VarSLet:='¡';
if (Length(VarSLet)=1) and (VarSLet='¿') then VarSLet:='¿';
if (Length(VarSLet)=1) and (VarSLet='<') then VarSLet:='<';
if (Length(VarSLet)=1) and (VarSLet='>') then VarSLet:='>';
if (Length(VarSLet)=1) and (VarSLet='"') then VarSLet:='"e;';
if (Length(VarSLet)=1) and (VarSLet='©') then VarSLet:='©';
if (Length(VarSLet)=1) and (VarSLet='®') then VarSLet:='®';
if (Length(VarSLet)=1) and (VarSLet='$') then VarSLet:='$';
if (Length(VarSLet)=1) and (VarSLet='%') then VarSLet:='%';
if (Length(VarSLet)=1) and (VarSLet='?') then VarSLet:='?';
if (Length(VarSLet)=1) and (VarSLet='=') then VarSLet:='=';
if (Length(VarSLet)=1) and (VarSLet='@') then VarSLet:='@';
if (Length(VarSLet)=1) and (VarSLet='¢') then VarSLet:='¢';
if (Length(VarSLet)=1) and (VarSLet='£') then VarSLet:='£';
if (Length(VarSLet)=1) and (VarSLet='€') then VarSLet:='€';
if (Length(VarSLet)=1) and (VarSLet='!') then VarSLet:='!';
if (Length(VarSLet)=1) and (VarSLet='#') then VarSLet:='#';
if (Length(VarSLet)=1) and (VarSLet='/') then VarSLet:='/';
if (Length(VarSLet)=1) and (VarSLet='\') then VarSLet:='\';
VarSMiTex:=VarSMiTex+VarSLet
end;
end;
end;
Result:=VarSMiTex;
end;
Ya sabéis sois libres de Criticarla, codificarla destruirla, etc.