deepak kumar deepak kumar - 10 months ago 47
iOS Question

How to get data from string after particular backslash?

I have a string such as

. Now I want to get data from uplaod onwards. Please suggest any function or code?

Answer Source

If path of image is not fixed or order of uplaod is not specific try like this.

let string = "\\home\\var\\path\\uplaod\\abc.png"
if let range = string.range(of: "uplaod") {
    let imagePath = string.substring(from: range.lowerBound)