What is the recommended way to convert a string to an integer in Red?
One way I found is:
load "123"
== 123
Is load the best way of getting an integer from a string in Red?
Is there any danger in using load in this way specifically if the string is from an unvalidated source?
Currently, that is the only way, as
toaction has not been implemented yet. It is safe usingload, as it does not do any kind of evaluation and the construction syntax support is very basic (covering just none and logic values).EDIT:
toaction is now available from v0.6.2 on, soto-integer "123"can be used too.