« 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
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 $

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):
Post:
 
All HTML will be escaped. Textile formatting is allowed.