I have a text-box, where I will be getting URL
URLs can be entered in any of the following format:
example.com
www.example.com
http://example.com
http://www.example.com
example.com/
www.example.com/
http://example.com/
http://www.example.com/
I need to convert them to single
http://example.com/
How can I do it, there must be simple way round to do it, right?
If you really only expect this few variations you could solve this, with a regex. For example
I didn’t test it, but should work.. If not, let me know 🙂
** Edit **
Just tested it. Works fine. At least for the formats you specified.