How to replace a substring with a link(http) in swift 3?

Viewed 1158

I have a string and substring(http) and I want to replace that substring but I don't know when that substring will end. I mean want to check it until one space is not coming and after that I want to replace it. I am checking that if my string contains http which is also a string then I want to replace it when space will come.

Here below is my example :-

let string = "Hello.World everything is good http://www.google.com By the way its good". 

This is my string It can be dynamic also I mean in this above string http is there, so I want to replace "http://www.google.com" to "website". So it would be

string = "Hello.World everything is good website By the way its good"
2 Answers
Related