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
  #7  
Antiguo 19-04-2012
BrunoBsso BrunoBsso is offline
Miembro
 
Registrado: nov 2009
Ubicación: Berisso, Buenos Aires, Argentina
Posts: 239
Poder: 15
BrunoBsso Va por buen camino
Hola ZayDun. La solución que te traigo podrá no ser la mejor, pero está bastante modularizada y se entiende, así que la podés modificar para que se ajuste a lo que precisás.
No tengo un compilador acá en el trabajo así que no pude probarlo.
Código Delphi [-]
function OnlyNums(Str: String): Boolean;
const
  NUMS = [#48 .. #57]; //'0' .. '9'
var
  I: Integer;
begin
  Result := True;
  for I := 1 to Length(Str) do
  begin
    if not(Str[i] IN NUMS) then
    begin
      Result := False;
      Exit;
    end,
  end;
end;

function OnlyCaps(Str: String): Boolean;
const
  CAPS = [#65 .. #90]; //'A' .. 'Z'
var
  I: Integer;
begin
  Result := True;
  for I := 1 to Length(Str) do
  begin
    if not(Str[i] IN Caps) then
    begin
      Result := False;
      Exit;
    end,
  end;
end;


function OnlyNumsOrCaps(Str: String): Boolean;
begin
  Result := OnlyNums(Str) or OnlyCaps(Str);
end;

procedure ParseStr(MyStr: String);
//MyStr := 'abc DEF ghi JKL MNÑ oPq RS1 2TUV xzc2 hn2d AJ7J kekgnwo'
var
  SList: TStringList;
  I: Integer;
begin
  SList := TStringList.Create;
  SList.Delimiter := #32;
  SList.DelimitedText := MyStr;
  for I := 0 to SList.Count-1 do
    if (OnlyNumsOrCaps(SList[i]) and Length(SList[i]) = 5) then
      ShowMessage(SList[i]);
end;

Saludos!!
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
Buscar sin diferenciar mayusculas de minusculas DARK_WARRIOR Conexión con bases de datos 5 09-12-2007 06:59:51
Buscar string dentro de un archivo de texto didier Varios 4 13-04-2007 21:14:00
Buscar un string dentro de otro FunBit Varios 2 27-01-2006 14:45:16
Buscar texto en mayusculas y minusculas (SQL). Tecnic2 SQL 7 20-04-2005 19:09:35
Buscar texto indistintamente en Mayusculas o minusculas Jose Manuel SQL 3 24-04-2004 09:57:43


La franja horaria es GMT +2. Ahora son las 18:13:25.


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