The floating-point value of the string as a float
.
SDKs
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
var floatValue: Float { get }
Discussion
This property doesn’t include whitespace at the beginning of the string. This property is HUGE
or –HUGE
on overflow, 0
on underflow. This property is 0
if the string doesn’t begin with a valid text representation of a floating-point number.
This method uses formatting information stored in the non-localized value; use an Scanner
object for localized scanning of numeric values from a string.