-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())! } } 
0

1 Answer 1

2

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

let cleanString = self.stringByReplacingOccurrencesOfString("+", withString: "") 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.