---
url: >-
  /statelake/scripting-reference/functions-and-procedures/conversion-functions/strtofloat.md
---

# StrToFloat

The **StrToFloat** function converts a **String** into a **Float** data type.

If the value that is in the **String** contains currency formatting, then use the **FloCurrStrToFloat** function instead.

**StrToFloat** will accept the decimal place full-stop (.) only as the decimal symbol, regardless of any Windows setting.

If the **String** does not contain a numeric value, then an error will occur. In this case you could use a **Try...Except** block to handle the error and provide a default value.

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

A simple example follows.

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