Forum Discussion

kburns's avatar
kburns
Visitor
15 years ago

Casting / converting) from int to string (file under n00b)

Sorry for the heavily n00b'ed question (I'm sure I'll have more to come).

I am trying to covert an int to string (generating a random hex number)
Along the way I did something like this for debugging.

    foofoofoo = "#" + str(5) + "0" + str(5) + "0" + str(5) + "0" 
Print foofoofoo


Each time this is printed out with a space in front of each 5.
The printed string looks like:

# 50 50 50


Any ideas why these spaces are in there?
And more importantly how can I eliminate the spaces?

1 Reply

  • The space is where the sign would go if the number were negative. The ToStr() function, documented on p42 of the BrightScript Reference Manual will not add that space.