Hola, me he pasado a
Delphi hace dos dias y he pasado esta funcion que tenia hecha en
VB6... :P
http://foro.rthacker.net/programacion-visual-basic/%28src%29-%28funcion%29-text_between_words-%28by-*psyke1*%29/
(* * * * * * * * * * * * * * * * * * * * * * * * * *)
(* Function : Text_Beetwen_Words *)
(* Author : *PsYkE1* *)
(* Mail : vbpsyke1@mixmail.com *)
(* Date : 24/8/10 *)
(* Purpose : Returns text which is beetwen *)
(* two words. *)
(* Visit : http://foro.rthacker.net/ *)
(* * * * * * * * * * * * * * * * * * * * * * * * * *)
function InStr(iStart: integer; sText: string; sWord: string): integer;
begin
Result := Pos(sWord,Copy(sText,iStart,Length(sText) - (iStart - 1)));
end;
function Text_Beetwen_Words(sTextToAnalyze:String ; sStartWord:String ; sEndWord:string): String;
var
iPosition1 : Integer;
iPosition2 : Integer;
iStart : Integer;
begin
iPosition1 := Instr(1,sTextToAnalyze,sStartWord);
if iPosition1 > 0 then
begin
iStart := (iPosition1 + Length(sStartWord));
iPosition2 := Instr(iStart,sTextToAnalyze,sEndWord);
end
else
exit;
if iPosition2 > 0 then
Result := Copy(sTextToAnalyze,iStart,iPosition2 -1);
end;
Un ejemplo:
procedure TForm1.FormCreate(Sender: TObject);
begin
(* añade un textbox *)
edit1.Text:= text_beetwen_words('Hoy estoy muy aburrido','Hoy ',' aburrido');
end;
end.
Devuelve esto:
Citarestoy muy
DoEvents¡! :P
Me encanto ;D Lindo Source
Salu2
[vHn]
Gracias, ire pasando mis funciones de vb a delphi progresivamente...
DoEvents¡! :P