Reputation: 1807
In rails I simply want to remove 'http://' or 'https://' from a string if they are present. Currently I'm achieving this with the below code:
install_url.delete('http://').delete('https://')
I feel like this might not be the best way to do it. Are there any better suggestions?
Thank you!
Upvotes: 2
Views: 404
Reputation: 9693
You can use regular expressions:
install_url.sub(/^http[s]?:\/\//, '')
Upvotes: 2