[ create a new paste ] login | about

Link: http://codepad.org/8dnczwsR    [ raw code | output | fork ]

Ruby, pasted on Dec 11:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def getaccountbalance(string)
  str = string.split("$").at(1).delete(',').to_f;
  return str
end

a = "PRIV CLIENT PLUS (...5245)$62,763.78"
b = "INVESTMENT ACCOUNT (...9879)$10,081.60"

c = getaccountbalance(a)
d = getaccountbalance(b)

# when I try 
e = c - d 
puts e


Output:
1
52682.18


Create a new paste based on this one


Comments: