Custom Function for Automated Phone # Format

Custom Function for Automated Phone # Format

I'm looking for a custom function which would automatically change the number's input format.

For example:

When Lead/Contact/Account is Edited or Created
and
Phone/Mobile is 305-305-3005
then
Phone/Mobile to (305) 305-3005

Thanks!