Forum Discussion

lumpenprole's avatar
lumpenprole
Channel Surfer
11 years ago

Potential bug on StrI()

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

4 Replies

  • "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.
  • 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
  • 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.