My ruby skills are a bit underdeveloped, but I managed to whip up a
Helper that inserts a delimiter at a fixed position in a number.
Any wizards out there that can give tips on how to scale this to
accepting calls for putting a delimiter at more than 1 position?
def insert_delimiter_at(number, pos, delimiter="-")
begin
number = number.to_s
parts = []
parts[0] = number.to(pos-1)
parts[1] = number.from(pos)
number = parts.join delimiter
rescue
number
end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---