Here’s the code I just wrote for it:

extension URL {

func strippingTrailingSlash() -> String {

var string = absoluteString

if string.last == "/" {

string.removeLast()

}

return string

}

}

Reply to this note

Please Login to reply.

Discussion

No replies yet.