How do I convert from symbol to integer?

Convert to string, then to int by applying the $ (cast) operator while passing an uppercase type character as its left argument:

q)”I” $ string `123
123
q)

Type number also works:

q)type 123
-6h
q)-6h $ string `123
123
q)

See also: string to symbol conversion faq, Datatypes and $

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.