Studio provides several conversion functions, allowing you to cast strings to numbers, or numbers to strings.

| Function | Description |
| --- | --- |
| [float(`string`)](https://docs.foursquare.com/analytics-products/docs/expressions-conversion#float) | Converts `string` to a `float`. Leading characters must be numbers. All input after the last number is ignored. |
| [int(`string`)](https://docs.foursquare.com/analytics-products/docs/expressions-conversion#int) | Converts a `string` to an `integer`. Leading characters must be numbers. All input after the decimal point is ignored. |
| [str(`real`)](https://docs.foursquare.com/analytics-products/docs/expressions-conversion#str) | Converts a number to a `string`. |

---

# float  
Convert columns identified as `string` to the `float` data type. Numbers past the decimal point are preserved. Any non-number character will end the conversion. For example, `$14.32` _will not_ successfully convert into a float. `14.32 dollars` will convert to a float.

### Example  
Suppose `progress` is a column that contains the following data schema:

| progress |
| --- |
| 19.2% complete |
| 51.452% complete |
| 100% complete |

Convert `progress` to float in a new column `progress_float`:

JavaScript
```javascript
float(progress);
```

The new column will be converted to `float`:

| progress\_float |
| --- |
| 19.2 |
| 51.452 |
| 100 |

---

# int  
Convert columns identified as `string` to the `int` data type. Numbers before the decimal point are preserved. Any non-number character will end the conversion. For example, `$14.32` _will not_ convert into an int. `14.32 dollars` will convert to an int.

### Example  
Suppose `progress` is a column that contains the following data schema:

| progress |
| --- |
| 19.2% complete |
| 51.452% complete |
| 100% complete |

Convert `progress` to `int` in a new column `progress_int`:

JavaScript
```javascript
int(progress);
```

The new column will be converted to `int`:

| progress\_int |
| --- |
| 19 |
| 51 |
| 100 |

---

# str  
Converts columns identified as a `number` (either `int` or `float`) to the `string` data type.

### Example  
Suppose `progress` is a column that contains the following data schema:

| progress |
| --- |
| 19.2 |
| 51.452 |
| 100 |

Convert `progress` to `string` in a new column `progress_string`:

JavaScript
```javascript
string(progress) + "% complete";
```

| progress\_string |
| --- |
| 19.2% complete |
| 51.452% complete |
| 100% complete |

Updated 5 months ago
