[Solved] Format a string containing Phone numbers

[ad_1]

This will take care of 0‘s in between the phone numbers

phone="08763843478,+918763843478,08763843478,+918763843478,+918763840008"
phone.split(',').map{|num| num.gsub(/^\+91|^0/, '')}.join(',')

#=> "8763843478,8763843478,8763843478,8763843478,8763840008"

0

[ad_2]

solved Format a string containing Phone numbers