---
url: /flow/guide/scripting-reference/functions/conversion/strtofloat.md
---

# StrToFloat

## Declaration

`Function StrToFloat( const S : string) : Extended`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
var MyAmount : String
begin
MyAmount := '123.3456';
Value := StrToFloat(MyAmount); //Value will be equal to 123.3456
end;
```

## Description

StrToFloat converts a string into a Float data type. If string does not contain a numeric value an error will occur. If the value contains currency formatting then use [FloCurrStrToFloat](/flow/guide/scripting-reference/functions/conversion/currstrtofloat) function.

You could use a [Try...Except](/flow/guide/scripting-reference/statements/try...except) block to handle the error and provide a default value.
