## How do I convert a character to its ASCII code?

By passing the integer type symbol, `int, as the left argument to the \$ (cast) operator:

q)`int \$ “A”
65
q)

You can convert a list of characters at once:

q)`int \$ “Hello, world!”
72 101 108 108 111 44 32 119 111 114 108 100 33
q)

Alternatively, the left argument to \$ (cast) can also be the integer type character, “i” or type value 6h:

q)”i” \$ “Hello, world!”
72 101 108 108 111 44 32 119 111 114 108 100 33
q)
q)type 1 2 3
6h
q)6h \$ “Hello, world!”
72 101 108 108 111 44 32 119 111 114 108 100 33
q)

## How do I declare a table column of type string (not symbol!)?

Declare it without a type as follows:

```q)t: ([] str: ())
q)meta t
c  | t f a
---| -----
str|
q)
```

A the type of a column defined as () is determined when the first row is inserted:

```q)`t insert enlist enlist "foo"
,0
q)t
str

{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "How do I declare a table column of type string (not symbol!)?",
"image": {
"@type": "imageObject",
"url": "https://pipdigz.co.uk/p3/img/placeholder-square.png",
"height": "500",
"width": "500"
},
"publisher": {
"@type": "Organization",
"name": "kdbfaq",
"logo": {
"@type": "imageObject",
"url": "https://pipdigz.co.uk/p3/img/placeholder-publisher.png"
}
},
"mainEntityOfPage": "https://www.kdbfaq.com/how-do-i-declare-a-table-column-of-type-string-not-symbol/",
"url": "https://www.kdbfaq.com/how-do-i-declare-a-table-column-of-type-string-not-symbol/",
"datePublished": "2011-03-27",
"dateModified": "2018-03-03",
"description": "Declare it without a type as follows: q)t: ([] str: ()) q)meta t c | t f a ---| ----- str| q) A the type of a column defined as () is determined when the first row is inserted: q)`t insert enlist enlist &quot;foo&quot; ,0 q)t str",
"articleBody": "Declare it without a type as follows: q)t: ([] str: ()) q)meta t c | t f a ---| ----- str| q) A the type of a column defined as () is determined when the first row is inserted: q)`t insert enlist enlist &quot;foo&quot; ,0 q)t str",
"author": {
"@type": "Person",
"name": "kdbfaq"
}
}

```