cvK()
What does cvK() do?
cvK() converts the value inside to another type based on K. K should be a type constant (tn, ts, tb, ta). Most conversions are possible except array to number and strings that aren't base ten numbers to numbers i.e. "Hello" to number
from ArrayExpressions import arrex
lst = [1, 2, 3, 4, 5]
output = arrex.evaluate(lst, "cv{ts}(20)")
print(output) # "20"
Curly brackets are reccommended to make the code cleaner, but are not necessary unless a custom function is created like 'cvts' where you would need to use curly brackets or spaces: cv ts(20)
Other Important Information:
Input | ArrEx code that returns a value. Can't convert arrays or some strings to numbers |
---|---|
Does it create a new scope? | Yes |
Output | An array of all the values calculated |
K | Any type constant |
I | The same index as last scope |
Example | cv{tb}(0) |
Example Explanation | This converts 0 to a boolean, which will be false |