Adam Groves schrieb:
> I'm trying to write a class which converts a number into letters like 
> so:
> 0  => -
> 1  => A
> 10 => J
> 27 => AA

Only after reading the other posts, I realized you want Y, Z, AA, AB, AC
and not Y, Z, AA, BB, CC, which is what is produced by this:

def letter(i)
  return '-' if i < 1
  ('A'..'Z').to_a.at(i%26 - 1) * ((i-1)/26 + 1)
end

Malte