Hola,
Probablemente con lo que aporta el compañero Neftalí baste, pero, en fin, ya lo había hecho...
Código Delphi
[-]
unit UAbecedario;
interface
type
TAbecedario = class(TObject)
private
FLetras: string;
FPosicion: byte;
public
constructor Create();
function Actual(): char;
function Anterior(): char;
function Siguiente(): char;
end;
implementation
resourcestring
rsLetras = 'abcdefghijklmnñopqrstuvwxyz';
constructor TAbecedario.Create();
begin
inherited Create();
FPosicion := 1;
FLetras := rsLetras;
end;
function TAbecedario.Actual(): char;
begin
result := FLetras[FPosicion];
end;
function TAbecedario.Anterior(): char;
begin
Dec(FPosicion);
if (FPosicion = 0) then
FPosicion := Length(rsLetras);
result := FLetras[FPosicion];
end;
function TAbecedario.Siguiente(): char;
begin
Inc(FPosicion);
if (FPosicion > Length(rsLetras)) then
FPosicion := 1;
result := FLetras[FPosicion];
end;
end.
Supongo que puede mejorarse... o en todo caso hacerse de otro modo más elegante. Aporto, en todo caso, un ejemplo de uso de la clase que he copiado arriba.