# toString() not adding 0 in front

**URL:** <https://forum.kirupa.com/t/tostring-not-adding-0-in-front/280336>\
**Category:** flash\
**Created:** [January 26, 2009, 3:00pm UTC](https://forum.kirupa.com/t/tostring-not-adding-0-in-front/280336 "2009-01-26T15:00:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vxd](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@vxd](https://forum.kirupa.com/u/vxd)\
**Post date:** [January 26, 2009, 3:00pm UTC](https://forum.kirupa.com/t/tostring-not-adding-0-in-front/280336/1 "2009-01-26T15:00:30Z")

</div>

Hi,

I’m trying to convert 0xcolour into colour using toString(16). The problem I’ve got is it’s not adding the zeroes in front of the number.

here is the code

[AS]var aColours:Array=new Array(0x000000,0x0000FF,0xFF0000,0x009933,0xFFFFFF);

for (var i = 0; i\<aColours.length; i++) {  
trace(aColours\*.toString(16));  
}  
[/AS]

This is what I get back

```auto
0
ff
ff0000
9933
ffffff

```
