Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jackhand
Visitor

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

Tags (1)
0 Kudos
1 REPLY 1
tim_beynart
Channel Surfer

Re: StrI() Function create whitespace

The space is there for the negative sign. Use toStr() on the number instead. https://sdkdocs.roku.com/display/sdkdoc/ifToStr

myInteger = 12345
myIntegerString = myInteger.ToStr()
Tags (1)
0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!