Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lumpenprole
Channel Surfer

Potential bug on StrI()

So, it seems that StrI() introduces a leading whitespace, whereas ToStr() does not. Just thought I'd let someone know.
0 Kudos
4 REPLIES 4
RokuKC
Roku Employee
Roku Employee

Re: Potential bug on StrI()

0 Kudos
belltown
Roku Guru

Re: Potential bug on StrI()

"lumpenprole" wrote:
So, it seems that StrI() introduces a leading whitespace, whereas ToStr() does not. Just thought I'd let someone know.

I don't think I've ever used Strl(), for that reason.
0 Kudos
Komag
Roku Guru

Re: Potential bug on StrI()

When you print to console, it apparently uses StrI(), so I'm in the habit of avoiding spaces since it will add one, such as:
PRINT "x is" x ", y is" y
instead of
PRINT "x is " x ", y is " y
0 Kudos
TheEndless
Channel Surfer

Re: Potential bug on StrI()

The extra space is for the sign. If you use it on a negative integer, there won't be an empty space. I almost always use .ToStr(), but you could always wrap the StrI()/Str() call in a Trim() to strip the white space.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos