Search code examples
swiftswift2swift-playground

Take value from float number after dot


How correctly extract second valued after coma in Float value.

Example:

var value = 5.435

And I would like to take value second value after coma, that is 3.

How to do this properly?


Solution

  • Maybe this: (int)( value * 100 ) % 10.