« How do I read in a text file? | Main | How do I cast a string to a symbol? »

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

Type number also works:

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

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

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
All HTML will be escaped. Textile formatting is allowed.