Hola.
Otra opción:
Código Delphi
[-]
function CincoMayusculas(Cad: string): TStrings;
var
c, p: Integer;
begin
c:= 1;
Result:= TStringList.Create;
while c < Length(Cad) do
begin
if Cad[c] in ['A'..'Z','Ñ','Á','É','Í','Ó','Ú'] then
begin
p:= 1;
while (Cad[c+p] in ['A'..'Z','Ñ','Á','É','Í','Ó','Ú'])and(p < 5) do
Inc(p);
if p = 5 then
begin
Result.Add(Copy(Cad,c,5));
c:= c + p;
end;
end;
Inc(c);
end;
end;
Ejemplo de llamada:
Código Delphi
[-]
var
Cad: string;
begin
Cad:= 'XBTCD carUVUAactENTEReresÑÁUTÍaleatorios FGHJK continuaeltexto UITXL';
ListBox1.Items:= CincoMayusculas(Cad);
end;
Saludos.