Swift : Convert (cast) Float to Int or Int32 value
Problem :
How to convert float variable value to type integer in Swift programming language?
Solution :
Use the Int()
function. For examples :
let x : Float = 8.0
var i : Int = Int(x)
or
let x : Float = 8.0
var i : Int32 = Int32(x)
Reference :
See also : Swift : Convert (cast) Float to String
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+8.3k Golang: Prevent over writing file with md5 hash
+22.1k Golang : Join arrays or slices example
+8.2k Golang : Reverse text lines or flip line order example
+11.1k Golang : Simple image viewer with Go-GTK
+10k Golang : Read file and convert content to string
+5.3k Golang : Generate Interleaved 2 inch by 5 inch barcode
+14.9k Golang : How to check for empty array string or string?
+8.1k Golang : Tell color name with OpenCV example
+10.6k Golang : How to delete element(data) from map ?
+11.9k Golang : Convert(cast) bigint to string