Ver Mensaje Individual
  #3  
Antiguo 30-12-2010
Avatar de Aleca
Aleca Aleca is offline
Miembro
 
Registrado: may 2003
Ubicación: Venado Tuerto, Argentina
Posts: 277
Reputación: 22
Aleca Va por buen camino
Fijate si te sirve algo asi.
Código Delphi [-]
procedure TForm1.SButtonClick(Sender: TObject);
var
  cTxt, cClave, cParcial: String;
  nPos, i: Integer;
  aCant: Array[0..5] of Integer;
begin
  aCant[0] := 3;
  aCant[1] := 2;
  aCant[2] := 3;
  aCant[3] := 3;
  aCant[4] := 2;
  aCant[5] := 3;
  i := 0;
  cTxt := 'COCA COLA/LIGHT /BOTELLA/PLASTICA / Lts / 2.5';
  cClave := '';
  while Length(cTxt) > 0 do
  begin
    nPos := Pos('/', cTxt);
    if nPos = 0 then //Por la ultima parte.
    begin
      nPos := Length(cTxt);
      cParcial := Copy(cTxt, 0, nPos);
    end
    else
      cParcial := Copy(cTxt, 0, nPos - 1);
    cClave := cClave + Copy(Trim(cParcial), 0, aCant[i]);
    cTxt := Copy(cTxt, nPos + 1, Length(cTxt) - nPos);
    inc(i);
  end;
  cClave := UpperCase(cClave);
  SButton.Caption := cClave;
end;
__________________
Aleca
Responder Con Cita