Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function ToSingle: Single; overload; inline; | Converts the text to a Single, correctly rounded. |
| 2 | class function ToSingle(const S: Substr.Substring): Single; overload; static; inline; | |
| 3 | class function ToSingle(const S: string): Single; overload; static; inline; |
Overload 1: function ToSingle: Single; overload; inline;
Converts the text to a Single, correctly rounded.
Returns: Single - The value; NAN, INF, +INF and -INF are read as special values.
Remarks:
Accepted: leading spaces, a sign, digits with at most one decimal separator (FormatSettings.DecimalSeparator), an exponent (E or e, a sign, at least one digit), trailing spaces; the sign and the exponent are optional. Any other text, or one whose nearest Single is infinite, raises EConvertError: '<text>' is not a valid floating point value for Single type. The class forms take every text kind.
Examples
A text with an exponent.
uses Substr;
procedure Example;
begin
Assert(Substring('25e-1').ToSingle = 2.5);
end;
Overload 2: class function ToSingle(const S: Substr.Substring): Single; overload; static; inline;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | S | Substr.Substring |
Returns: Single
Overload 3: class function ToSingle(const S: string): Single; overload; static; inline;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | S | string |
Returns: Single