lib/extended_classes.rb
# this is used to convert a number into segments of
# base 62 (or 36) for use in creating email IDs
this is used to convert a number into segments of
base 62 (or 36) for use in creating email IDs
this is used to convert a number into segments of base 62 ( or 36 ) for use in creating email IDs
def to_b(base=10)
    n = self
    r = ""
    while n > 0
      m = n%base
      n /= base
      case
      when m>=36
        k = m+61
      when m>=10
        k = m+55
      when m>=0
        k = m+48
      end
      r << k.chr
    end
    return r.reverse
  end
def to_b ( base = 10 ) n = self r = "" while n > 0 m = n % base n /= base case when m >= 36 k = m + 61 when m >= 10 k = m + 55 when m >= 0 k = m + 48 end r << k . chr end return r . reverse end
this is used to convert a number into segments of
base 62 (or 36) for use in creating email IDs
this is used to convert a number into segments of base 62 ( or 36 ) for use in creating email IDs
base
<not_specific>