Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 05-03-2010
BrunoBsso BrunoBsso is offline
Miembro
 
Registrado: nov 2009
Ubicación: Berisso, Buenos Aires, Argentina
Posts: 239
Poder: 15
BrunoBsso Va por buen camino
Hola.
Mirá, esta solución la acabo de "crear" (entre comillas porque seguro ya existe) y no se si será la más eficiente del mundo, seguro hay otra mucho mas eficiente. Pero a mí me funcionó y en definitiva eso es lo que cuenta.
Uso un TEdit para el texto, vos usá lo que necesites amoldándolo al código.
Basta de preámbulos, te paso el código que hice:
Código Delphi [-]
function EmpiezaHTTP(T:String; Indice:Integer):Boolean;
{DEVUELVE TRUE SI LA CADENA ENVIADA EMPIEZA CON HTTP}
begin
  Result:=False;
  if (LowerCase(T[Indice])='h') then
    if (LowerCase(T[Indice+1])='t') then
      if (LowerCase(T[Indice+2])='t') then
        if (LowerCase(T[Indice+3])='p') then
          if (LowerCase(T[Indice+4])=':') then
            if (LowerCase(T[Indice+5])='/') then
              if (LowerCase(T[Indice+6])='/') then
                Result:=True;
end;

procedure StrListToMemo(var Memo:TMemo; StrList:TStringList);
{ESTE PROC ALMACENA EL CONTENIDO DE UN TStringList EN UN TMemo}
var
  I:Integer;
begin
  for I := 0 to StrList.Count - 1 do
    Memo.Lines.Append(StrList.Strings[i]);
end;

procedure TForm1.Button1Click(Sender: TObject);
{LO HAGO CON UN TEdit PARA SIMPLIFICARLO, VOS DESPUÉS ACOMODALO A TU GUSTO}
{GUARDO TODAS LAS URLs EN UN TMemo}
var
  ListaURLs:TStringList; //Acá vamos a guardar todas las URLs que encontremos
  StrAuxiliar:String; //Acá almacenamos el string que sería una URL
  I:Integer;
begin
  ListaURLs:=TStringList.Create;
  I:=1;
  while (I<=Length(Edit1.Text)) do begin
    StrAuxiliar:='';
    if (EmpiezaHTTP(Edit1.Text,I)) then begin
      CantMovimientos:=0;
      while (Edit1.Text[i]<>' ') do begin //En la condición, el espacio en blanco es el final del string para la URL
        StrAuxiliar:=StrAuxiliar+Edit1.Text[i];
        I:=I+1;
      end;
      ListaURLs.Append(StrAuxiliar);
    end;
    I:=I+1;
  end;
  StrListToMemo(Memo1,ListaURLs);
end;

Y así como funciona:


Espero que te sea útil, que te de la solución que necesitás.
Si alguien tiene una mejor, o una función que haga esto mismo, que la escriba así yo también aprendo
Saludos!

Última edición por BrunoBsso fecha: 05-03-2010 a las 07:34:56. Razón: Puse una imagen
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
leer palabras de ficheros de texto alba13 OOP 10 21-10-2007 16:15:15
Leer varios archivos de texto y extraer solo 2 lineas de ese texto mp3968 Internet 1 17-05-2007 20:24:09
Extraer el texto de un archivo UTF-8 ixMike Varios 0 10-10-2006 19:31:45
voz a texto, sacar palabras de audio sakuragi Varios 2 28-07-2006 19:35:31
Cambiar texto o palabras de un archivo dfm HombreSigma OOP 3 29-07-2003 23:50:54


La franja horaria es GMT +2. Ahora son las 13:40:07.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi