Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def self.str_to_dec str
- tok = str.split "-"
- if tok.size == 3
- g,p,s = tok.map{|m| m.to_f}
- return g + (p/60) + (s/3600)
- elsif tok.size == 2
- return tok.join('.').to_f
- elsif tok.size == 4
- #41-44-62-200
- return "#{tok[0]}.#{tok[1..-1].join}".to_f
- end
- puts "Err: #{str}"
- nil
- end
Add Comment
Please, Sign In to add comment