Conversion

Index

All Conversion functions

Name Function header Example Result Description Errorhandling
atoi func(a string) int [[ $result := atoi "1200" ]] $result = 1200 equivalent converts a string to an integer
float64 func(v interface{}) float64 [[ $result := float64 "1.200" ]] $result = 1.2 converts to a float64
int64 func(v interface{}) int64 [[ $result := int64 "1200" ]] $result = 1200 converts integer types to 64-bit integers
int func(v interface{}) int [[ $result := int "1200" ]] $result = 1200 converts to an int.
toByte func(s string) []byte [[ $result := toByte "This is a Test String" ]] $result = “This is a Test String” converts a string to a byte array

atoi

func(a string) int

The atoi function converts a string with numbers to an integer.

Examples


[[ $result := toString ( atoi "1200" ) ]]
$result = "1200"

result is an object of atoi
[[ $result := atoi "1200" ]]
$result = atoi{1200} 

float64

func(v interface{}) float64

The float64 function converts to a float64.

Application notes / Limits:

The string with numbers can have a radix character to separate integral (left) from the fractional part (right)).

Examples


[[ $result := toString (float64 "1.200") ]]
$result = "1.2"

result is an object of float64
[[ $result := float64 "1.200" ]]
$result = float64{1.2}

int

func(v interface{}) int

The int function converts to an int at the system’s width.

Examples


[[ $result := toString ( int "1200" ) ]]
$result = "1200"

result is an object of int
[[ $result := int "1200" ]]
$result = int{1200}

int64

func(v interface{}) int64

The int64 function converts integer types to 64-bit integers

Examples


[[ $result := toString ( int64 "1200" ) ]]
$result = "1200"

result is an object of int64
[[ $result := int64 "1200" ]]
$result = int64{1200}

toByte

func(s string) []byte

The toByte function converts a string to a byte array.

Examples


Console-Example because of toByte-Output can't be displayed in string. 
[[ toByte "This is a Test String" ]]
console-result: [84 104 105 115 32 105 115 32 97 32 84 101 115 116 32 83 116 114 105 110 103]
[[ toByte "1200" ]]
console-result: [49 50 48 48]

[[ $result := toString ( toByte "1200" ) ]]
$result = "1200"

[[ $result := toString ( toByte "This is a Test String" ) ]]
$result = "This is a Test String"