Como trocar uma string por uma quebra de linha?
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
Ex:
linha1<EOF>linha2<EOF>linha3
Desde já agradeço
[]s
Titanius
Curtidas 0
Respostas
Marco Salles
30/03/2004
Voce Ja Tentou Trocar a String Por :
linha1+#13+linha2+13+linha3
linha1+#13+linha2+13+linha3
GOSTEI 0
Lucas Silva
30/03/2004
Tenta substituir ela por #13.
linha1+13+linha2+13+linha3
linha1+13+linha2+13+linha3
GOSTEI 0
Titanius
30/03/2004
Porem, eu recebo uma string
como substituo ele nesta string?
[]s
´linha1<EOF>linha2<EOF>´
como substituo ele nesta string?
[]s
GOSTEI 0
Paulo_amorim
30/03/2004
Olá
Utilize a funcao StringReplace(txt, ´<EOF>´, #13);
Espero que funcione
Até+
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é+
GOSTEI 0
Marco Salles
30/03/2004
Paulo Amorim:
Ou Tente Com a Rotina Abaixo:
P:S Utilizo Como Fim De Arquivo a String = ´<EOF>´ Em Letras Maisculas
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
GOSTEI 0
Henry
30/03/2004
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;
GOSTEI 0
Titanius
30/03/2004
Pow, valeu galera!!!!! funcionou... me salvaram hein....
:D :D :D :D
[]s
:D :D :D :D
[]s
GOSTEI 0