Linked Questions

-1 votes
1 answer
3k views

Swift 4 adding a label.text int to a button int [duplicate]

I currently have a label that displays the value of a database read. The database has the value as a string. Through viewWillAppear, the database is read and will display the correct value in the ...
Palmeeze's user avatar
0 votes
2 answers
1k views

Convert entire string into integer and display it in textfield swift [duplicate]

I want to develop an application that can convert UITextField values into integer, float and double. I am facing problem to convert String value into Integer. Can anyone suggest the better way for ...
ayushi Vankawala's user avatar
1 vote
1 answer
690 views

converting String to Int failure [duplicate]

I've two variables number and number2 with String value, I want to convert those Strings to Int and add to each other,but the compiler returns error: Binary operator '+' cannot be applied to two 'Int?'...
Joe Rogan's user avatar
0 votes
1 answer
552 views

User expected to input integer into Text Field [duplicate]

I'm having some difficulty getting one of my view controllers to recognize a text input. I'm getting the "Cannot convert value of type 'String' to expected argument type 'Int'" error. I've seen some ...
Bob F.'s user avatar
  • 93
-2 votes
2 answers
337 views

How can I convert a String to an Int in swift? [duplicate]

I'm working in a small project and I faced this problem : text field is String by default so I need to take the input and convert it to integer then calculate I was searching for a way to solve the ...
keloa's user avatar
  • 115
0 votes
1 answer
189 views

I need help converting a UITextField from string to Int [duplicate]

I have made a simple project which sends data from one view controller to a second. It works for a string, but I now want to change the code so it can multiply the UITextField answer by 10 and output ...
Ben Chevassut's user avatar
0 votes
1 answer
94 views

swift optional types what to do [duplicate]

Please help me to solve a small problem. Im trying to parse string value to int, or I don't know how to say, I'm a newby in programming =) the problem is that Xcode rails on my code: if let age: Int =...
Sergei's user avatar
  • 11
0 votes
1 answer
99 views

Add string with int [duplicate]

i have a problem on Xcode7 i want to add some numbers from a text box with an integer i already have but this code seems not to be working: @IBAction func ConvertAction(sender: AnyObject) { /...
St33v3n's user avatar
  • 39
0 votes
0 answers
23 views

UITextField check if user typed in numeric [duplicate]

I am very new to coding, therefore sorry if this question is really silly) I am making a program which will get users input through text field, multiply it by 2 and then return user the result. I need ...
Kseniia Piskun's user avatar
80 votes
7 answers
63k views

Adding Thousand Separator to Int in Swift

I am fairly new to Swift and having a great deal of trouble finding a way to add a space as a thousand separator. What I am hoping to achieve is taking the result of a calculation and displaying it ...
alionthego's user avatar
45 votes
10 answers
62k views

Swift How to get integer from string and convert it into integer

I need to extract numbers from string and put them into a new array in Swift. var str = "I have to buy 3 apples, 7 bananas, 10eggs" I tried to loop each characters and I have no idea to compare ...
alphonse's user avatar
  • 717
61 votes
5 answers
53k views

.toInt() removed in Swift 2?

I was working on an application that used a text field and translated it into an integer. Previously my code textField.text.toInt() worked. Now Swift declares this as an error and is telling me to ...
Amit Kalra's user avatar
  • 4,113
44 votes
3 answers
11k views

Why was UITextField's text property changed to an optional in Swift 2?

According to the UIKit diff document, in ios9/Swift 2 var text: String! has become var text: String? According to the documentation for UITextField it specficially says This string is @"" by ...
Will's user avatar
  • 2,752
14 votes
4 answers
12k views

Convert Array of UnicodeScalar into String in Swift

I have an array of unicode scalars (Type is [UnicodeScalar]) like: let array = [UnicodeScalar("f")!, UnicodeScalar("o")!, UnicodeScalar("o")!] or let array2 = "bar".unicodeScalars how can I ...
nacho4d's user avatar
  • 45.5k
11 votes
5 answers
18k views

Swift: How to convert String to UInt?

According to Swift - Converting String to Int, there's a String method toInt(). But, there's no toUInt() method. So, how to convert a String to a Uint?
ma11hew28's user avatar
  • 127k

15 30 50 per page