Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 7

StrI() Function create whitespace

I noticed the StrI() Function create whitespace in front of the string. For example the following operation StrI(3) produces the following string " 3" instead of "3".

The following is how I am currently eliminating the leading whitespace; however, is there a better way?

sString = StrI(n)
nWhitespace = Instr(1, sString , " ")
if nWhitespace = 1 then
   sString = Mid(sString , 2)
end if

0 Kudos
1 REPLY 1\
Level 8

Re: StrI() Function create whitespace

The space is there for the negative sign. Use toStr() on the number instead.

myInteger = 12345
myIntegerString = myInteger.ToStr()
0 Kudos