GLBasic forum

Main forum => GLBasic - en => Topic started by: Glint on 2008-May-18

Title: String format ?
Post by: Glint on 2008-May-18
Which is the best way to format/combine a string and a value in GLbasic ?
For example DrawSprite "Alien."
Title: Re: String format ?
Post by: Kitty Hello on 2008-May-19
Code (glbasic) Select

number = 1
string$ = "Alien." + number + ".png"
PRINT string$, 0,0
SHOWSCREEN
MOUSEWAIT


Like this?
Title: Re: String format ?
Post by: Moru on 2008-May-19
My guess is this is what he wants: Can't remember sprite/object numbers (http://www.glbasic.com/forum/index.php?topic=178.0)

Since he wants to draw a sprite with the name Alien.2 and so on, this code makes it easier :-)
Title: Re: String format ?
Post by: Glint on 2008-May-19
Thanks guys. The first two answers were what I was looking for, although Moru's link will be handy for me too. Too many numbers give me brain freeze, it's like my brain has a small 1k memory cache.    ;/
Title: Re: String format ?
Post by: Glint on 2008-May-19
>for tight loops, a 1K cache is more than you need....

In that case...time to defrag my brain  :S