-1

Question :: how to remove + from my string url

Problem :: while calling api i am getting + symbol at the end of url so how can i remove that +

here is my code which removing space

extension String {
  func encodeURL() -> String {
    return self.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())!

  }
}
Govind Rakholiya
  • 295
  • 1
  • 3
  • 20

1 Answers1

2

If you want to get rid of ANY occurrences of '+' you could use this

let cleanString =  self.stringByReplacingOccurrencesOfString("+", withString: "")
Vizllx
  • 9,135
  • 1
  • 41
  • 79
Russell
  • 5,436
  • 2
  • 19
  • 27