Type Conversion
type conversion functions
The following functions convert values between types:
int,int64: Converts to integer.float,double: Converts to double.string: Converts to string.bool: Converts to boolean.guid: Converts to GUID.json: Converts to JSON. See json for details on property access.
Spec
int(arg0)
int64(arg0)
float(arg0)
double(arg0)
string(arg0)
bool(arg0)
guid(arg0)
json(arg0) Parameters
arg0 - The value to convert. Return Value
The converted value in the target type. Example
Convert string to int:
datatable(s:string)["123", "456"]
| extend num = int(s) | s | num |
|---|---|
| 123 | 123 |
| 456 | 456 |
Convert int to string:
datatable(val:int64)[1, 2]
| extend str_val = string(val) | val | str_val |
|---|---|
| 1 | "1" |
| 2 | "2" |
Convert string to bool:
datatable(s:string)["true", "false"]
| extend b = bool(s) | s | b |
|---|---|
| true | true |
| false | false |
Convert string to GUID:
datatable(s:string)["b2e1975b-677c-4ac6-a0ed-e63acb67ff09"]
| extend id = guid(s) | s | id |
|---|---|
| b2e1975b-677c-4ac6-a0ed-e63acb67ff09 | b2e1975b-677c-4ac6-a0ed-e63acb67ff09 |