GARANTIR DESCONTO

Fórum Como trocar uma string por uma quebra de linha? #223339

30/03/2004

0

Olá, tenho a seguinte string <EOF>, como faco para troca-la por uma quebra de linha?

Ex:
linha1<EOF>linha2<EOF>linha3

Desde já agradeço

[]s


Titanius

Titanius

Responder

Posts

30/03/2004

Marco Salles

Voce Ja Tentou Trocar a String Por :
linha1+#13+linha2+13+linha3


Responder

Gostei + 0

30/03/2004

Lucas Silva

Tenta substituir ela por #13.
linha1+13+linha2+13+linha3


Responder

Gostei + 0

30/03/2004

Titanius

Porem, eu recebo uma string
´linha1<EOF>linha2<EOF>´



como substituo ele nesta string?

[]s


Responder

Gostei + 0

30/03/2004

Paulo_amorim

Olá

Utilize a funcao StringReplace(txt, ´<EOF>´, #13);

type TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase); function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string; Description StringReplace replaces occurrences of the substring specified by OldPattern with the substring specified by NewPattern. StringReplace assumes that the source string, specified by S, may contain Multibyte characters. If the Flags parameter does not include rfReplaceAll, StringReplace only replaces the first occurrence of OldPattern in S. Otherwise, all instances of OldPattern are replaced by NewPattern. If the Flags parameter includes rfIgnoreCase, The comparison operation is case insensitive.


Espero que funcione
Até+


Responder

Gostei + 0

30/03/2004

Marco Salles

Paulo Amorim:
Utilize a funcao StringReplace(txt, ´<EOF>´, #13);

Ou Tente Com a Rotina Abaixo:
function Quebra(Texto:String):String;
var
 i:Integer;
 Teste:String;
 Const
  Fim=´<EOF>´;
begin
 i:=1;
 while i<=Length(Texto) do
   begin
     if Texto[i]=´<´Then
       begin
         Teste:=Copy(Texto,i,5);
           if TeSTE=´<EOF>´ Then
             begin
               result:=result+13;
               i:=i+5;
             end;
       end;
     result:=result+Texto[i];
     i:=i+1;
   end;
end;

P:S Utilizo Como Fim De Arquivo a String = ´<EOF>´ Em Letras Maisculas


Responder

Gostei + 0

30/03/2004

Henry

Ou ainda c nada funfa, use isso....

Procedure TForm1.Button1Click (Sender: TObject);
Begin
FindReplace(Edit1.Text,Edit2.Text, Memo1);
end;
 
Procedure FindReplace (const Enc, subs: String; Var Texto: TMemo);
Var
i, Posicao: Integer;
Linha: string;
Begin
For i:= 0 to Texto.Lines.count - 1 do
begin
Linha := Texto. Lines[i];
Repeat
Posicao:=Pos(Enc,Linha);
If Posicao > 0 then
Begin
Delete(Linha,Posicao,Length(Enc));
Insert(Subs,Linha,Posicao);
Texto.Lines[i]:=Linha;
end;
until Posicao = 0;
end;
end;                        



Responder

Gostei + 0

31/03/2004

Titanius

Pow, valeu galera!!!!! funcionou... me salvaram hein....
:D :D :D :D

[]s


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar