# An opposite to .succ!   Or, a predecessor method for String.

# This little thing is for my own use, and entertainment.
# There are those that might recoil from by beginners drivel, but I 
# need a little help...

# I keep getting  'out of range' error no matter what I try
# when "a".pred!

class String

  def pred!
    begin
# get the ascii value of the last element in string and decrement it...
      self[self.size - 1] = (self[self.size - 1] - 1)    

      if self[self.size - 1]  == 96        # 'a' is the last char we want
          self.chop!                         #  when 'a'.pred! .chop char
          self[self.size - 1] = 122          #  set new last element to 'z'
      end
          return self
    end while self.size > 0                # hmmmm...
  end
end