string$

Just starting out? Need help? Post your questions and find answers here.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

string$

Post by blueznl »

sorry, another one...

is there a purebasic equivalent for STRING$? as in a$=string$(256,0)

i'm now delving deeply into purebasic, and there are so many things different from the way i was used to doing things, that i am sometimes lost... with the simplest of things...

browsing the forum and the docs don't always give me the answer (and i try, really!)

i'm going to put up a page with all the stupid things and mistakes i made to help other beginners out, once i get the hang of this language...
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1285
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

Since you are working with strings, the first place you should look is under "Strings" in the docs :)

The quick answer is...

If you are filling with empty space, you can use:
a$=Space(256)
...fills a$ with 256 empty characters.

If you want to fill with a specific character, you could use:
a$=LSet("",256,"x")
...fills a$ with 256 x's
Image Image
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1285
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

You could also do it the long, slower way...

a$=""
For tmp=1 To 256
a$+"X"
Next


:)
Image Image
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

this is what i get for being an old timer... i'm so stuck in old basic dialects (hey, i started on an excidy sorcerer, followed by a vic20) and all the long years (10 or so?) in gfabasic have made me expect certains things... worst of it all, i expected the different basic keywords to behave the same, and that is not a very wise thing...

sorry for asking the question, i hang my head in shame
(but don't worry, i keep on asking if i don't know :-))
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Vic20

Post by nessie »

Ah, the good old Vic20. Brings back many happy memories.!!
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4792
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Exidy Sorcerer?? YA!

Post by Fangbeast »

blueznl wrote:this is what i get for being an old timer... i'm so stuck in old basic dialects (hey, i started on an excidy sorcerer, followed by a vic20) and all the long years (10 or so?) in gfabasic have made me expect certains things... worst of it all, i expected the different basic keywords to behave the same, and that is not a very wise thing...

sorry for asking the question, i hang my head in shame
(but don't worry, i keep on asking if i don't know :-))
Gee, someone else as old as me in the forums:):) (I sure loved mine)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

try LSet("",256,"X")

GPI
TronDoc
Enthusiast
Enthusiast
Posts: 310
Joined: Wed Apr 30, 2003 3:50 am
Location: 3DoorsDown

Re: Exidy Sorcerer?? YA!

Post by TronDoc »

Fangbeast wrote:Gee, someone else as old as me in the forums:):) (I sure loved mine)
ditto :lol: Joe
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

still got a vic20 here :) unfortunately the wrong colour :( (it's a version 2, with brown instead of orange function keys)... if anybody has the game 'multibug' laying around somewhere (it's something i wrote ages ago, and actually even sold it)

but that's entirely off topic so i better discontinue this thread :wink:
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1285
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

GPI wrote:try LSet("",256,"X")

GPI
LOL @ GPI
That was already mentioned at the top of the post ;)
Image Image
Post Reply