Linked Questions

0 votes
2 answers
128 views

i'm getting my contacts number locally from my mobile. There are some number in which there are white spaces between numbers. I'm trying to remove the white spaces from the number but it isn't working,...
Hamza's user avatar
  • 125
436 votes
16 answers
231k views

Does Swift have a trim() method on String? For example: let result = " abc ".trim() // result == "abc"
tounaobun's user avatar
  • 14.9k
113 votes
11 answers
36k views

In the Introduction to Swift WWDC session, a read-only property description is demonstrated: class Vehicle { var numberOfWheels = 0 var description: String { return "\(...
Stuart's user avatar
  • 37.1k
19 votes
6 answers
21k views

How can I remove the whitespace character set from a string but keep the single spaces between words. I would like to remove double spaces and triple spaces, etc...
Tom Coomer's user avatar
  • 6,647
-1 votes
3 answers
1k views

How can I remove all white space from the beginning and end of a string? Like so: "Test User Image" returns "Test User Image" "Test User Image " returns "Test User ...
Sham Dhiman's user avatar
  • 1,596
1 vote
1 answer
1k views

I want to display attributed text label inside a scrollview. I use the following code the label displays the text in centre and some extra white space is added in top and bottom. NSString *...
Jayasabeen Appukuttan's user avatar
2 votes
2 answers
201 views

In Perl if I had trailing blanks in a string, I would use this code $line =~ s/ +$//; Is there a similar command or function in swift?
μολὼν.λαβέ's user avatar
-1 votes
1 answer
340 views

Im trying to make an app that opens the safari app and searches for a specific keyword. I know how to open Safari and search a URL, but is there any way to do it with just a keyword?
Trip Phillips's user avatar
-1 votes
1 answer
115 views

I want to store float to CoreData and I want to convert every of the following inputs to 90.5: 90.5 90,5 90.5 90, 5 That means: Remove whitespace and convert , to . Is this code best practice? let ...
T. Karter's user avatar
  • 748
0 votes
2 answers
69 views

I'm creating a function which makes an API request. The function receives a parameter and put it inside the API call. It is like this: static func queryCities(cityNameString : String, completion: @...
user avatar