# & notation

**URL:** <https://forum.xojo.com/t/notation/14491>\
**Category:** General\
**Created:** [February 20, 2014, 6:05pm UTC](https://forum.xojo.com/t/notation/14491 "2014-02-20T18:05:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [February 20, 2014, 6:05pm UTC](https://forum.xojo.com/t/notation/14491/1 "2014-02-20T18:05:00Z")

</div>

There are a number of notations in the Xojo language that start with “&”, and I thought it would be handy to post them somewhere as reference.

- &b - A binary literal, like &b00001111, as an UInt32.
- &c - A color with RGB + alpha channel values as hex, like &c12ABCDFF, as a Color. (You can leave off the alpha channel, like &c12ABCD.)
- &h - A hexadecimal literal, like &h12AE, as an UInt32.
- &o - An octal literal, like &o777, as an UInt32.
- &u - A Unicode string with the given code point as hex, like &h201C (left double curly quote), as string.

You’d use these as you would any constant. Just type them without quotes in places where you might otherwise use a number, color, or string. For example, these both do exactly the same thing:

```auto
n = &b11111111
n = 255
```

So do these:

```auto
s = &u61
s = "a"
```

You can also use these within a string to convert that string to a number with Val. For example, if you have the string “0A”, you can use this code to convert it to a number:

```auto
s = "0A"
n = Val( "&h" + s )
// n = 10
```

Hope someone finds this useful. Personally, I didn’t know (or remember) about the “&u” notation until Norman posted about it today in another conversation.

---

<div class="post-metadata">

**Author:** ![Joe\_Ranieri](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@Joe\_Ranieri](https://forum.xojo.com/u/Joe_Ranieri)\
**Post date:** [February 20, 2014, 6:06pm UTC](https://forum.xojo.com/t/notation/14491/2 "2014-02-20T18:06:21Z")

</div>

&u is the least known but extremely useful. In 2014r1 it’ll be even more useful because 2014r1 supports constants whose value is a constant expression. So, for example:

```auto
Const CRLF = &u0C + &u0A
```

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [February 20, 2014, 6:16pm UTC](https://forum.xojo.com/t/notation/14491/3 "2014-02-20T18:16:58Z")

</div>

Typo correction.

```auto
Const CRLF = &u0D + &u0A
```

And cool.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [February 20, 2014, 7:08pm UTC](https://forum.xojo.com/t/notation/14491/4 "2014-02-20T19:08:27Z")

</div>

> [@66645:@Kem Tekinay](#):
>
> There are a number of notations in the Xojo language that start with “&”, and I thought it would be handy to post them somewhere as reference.

Like here [http://documentation.xojo.com/index.php/Category:Language\_Literals](http://documentation.xojo.com/index.php/Category:Language_Literals) ?

---

<div class="post-metadata">

**Author:** ![J\_Andrew\_Lipscomb](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/a4c791/32.png) [@J\_Andrew\_Lipscomb](https://forum.xojo.com/u/J_Andrew_Lipscomb)\
**Post date:** [February 21, 2014, 2:01am UTC](https://forum.xojo.com/t/notation/14491/5 "2014-02-21T02:01:35Z")

</div>

[quote=66646:@Joe Ranieri]&u is the least known but extremely useful. In 2014r1 it’ll be even more useful because 2014r1 supports constants whose value is a constant expression. So, for example:

```auto
Const CRLF = &u0C + &u0A
```

Nice. Perhaps it’s least-known because it’s the most recent addition? 🙂

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [February 21, 2014, 2:04am UTC](https://forum.xojo.com/t/notation/14491/6 "2014-02-21T02:04:42Z")

</div>

Handy when you want a particular symbol & can just use the code point

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:05pm UTC](https://forum.xojo.com/t/notation/14491/7 "2020-10-29T17:05:29Z")

</div>


