Module: Struggle::IntExtend

Defined in:
lib/struggle/concerns/int_extend.rb

Instance Method Summary collapse

Instance Method Details

#uppercaseObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/struggle/concerns/int_extend.rb', line 3

def uppercase
  cstr = ["", "", "", "", "", "", "", "", "", ""]
  cn_nums1 = ["", "", "", "", "", "", "", "", "", "", "", ""]
  cn_nums2 = ['', '']
  s = ""
  array = self.to_s.split(".")
  p h = array[0].to_s.split(//)
  ai = h.count
  h.each_with_index do |a, j|
    s+=cstr[a.to_i]+cn_nums1[ai-1]
    ai=ai-1
  end
  p h1 = array[1].to_s.split(//)
  aj = h1.count
  h1.each_with_index do |o, p|
    s+=cstr[o.to_i]+cn_nums2[aj-1]
    aj=aj-1
  end
  rstr = ""
  rstr=s.gsub("拾零", "")
  rstr=rstr.gsub("零拾", "");
  rstr=rstr.gsub("零佰", "");
  rstr=rstr.gsub("零仟", "");
  rstr=rstr.gsub("零萬", "");
  for i in 1..6 do
    rstr=rstr.gsub("零零", "");
    rstr=rstr.gsub("零萬", "");
    rstr=rstr.gsub("零億", "");
    rstr=rstr.gsub("零零", "");
  end
  rstr=rstr.gsub("零角", "");
  rstr=rstr.gsub("零分", "");
  rstr=rstr.gsub("零元", "");
end