# Create a bi-deci-heximal in AS3? eg create a base 62 numeral system in AS3

**URL:** https://forum.kirupa.com/t/create-a-bi-deci-heximal-in-as3-eg-create-a-base-62-numeral-system-in-as3/312058
**Category:** flash
**Created:** [July 24, 2010, 12:20am UTC](https://forum.kirupa.com/t/create-a-bi-deci-heximal-in-as3-eg-create-a-base-62-numeral-system-in-as3/312058 "2010-07-24T00:20:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Shaedo](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Shaedo](https://forum.kirupa.com/u/Shaedo)
#### Post date: [July 24, 2010, 12:20am UTC](https://forum.kirupa.com/t/create-a-bi-deci-heximal-in-as3-eg-create-a-base-62-numeral-system-in-as3/312058/1 "2010-07-24T00:20:39Z")

</div>

I was wondering if someone could give me some feedback on creating a base 62 numeral system in AS3.

Mostly as an intellectual exercise although, considering that it takes a byte to store an alphanumeric character regardless of what it is, I would use this when large numbers need to be stored as strings in text files (Eg .xml files).

Just to give an idea of what I am taking about:

An integer (int) can be any combinations of the characters 0,1,2,3,4,5,6,7,8 & 9.

But if we write ‘0x’ in the front we can then use the characters a/A, b/B, c/C, d/D, e/E & f/F for a hexadecimal base 16 numeral system.

The ultimate end point, and I really don’t know if it’s possible for me to achieve (I am sure anything conceivable would be achievable for someone with enough knowledge) would be to be able to create a prefix say ‘@x’ (replacing the ‘0x’ of hexadecimal) that would allow me to write something like this

```auto
var i:Int = @xgG4sops + 10;
trace(i);// 234524226 
//the number is just random I have not actually worked out what base 62 'gG4sops' would be in decimal

```

I am guessing for this to happen I would have to customise the int class but I am not even sure if this is possible with primitive classes?

The other, more simple alternative would be to simply create a class that takes a string and returns a conventional int, but I don’t see much challenge in just doing that.

Thanks for taking the time to consider my problem. Any feedback is greatly appreciated even if it’s just a link to something relevant you might have written previously on the topic.

S
