Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
string to array?
#1
How can I convert a string such as a$ to an array, where each part of the array contains one letter of the string.

for example


a$ = "cat"
dim array(3)

...


print array(1) 'should print c
print array(2) 'should print a
print array(3) 'should print t

etc
eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
Reply
#2
DIM, MID$() and LEN() and a FOR loop.

Here is the code:


len.a% = len(a$)
DIM array1$(1 TO len.a%)
FOR i% = 1 TO len.a%
array1$(i%) = MID$(a$, i%, 1)
NEXT i%
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#3
Thanks agamemnus, any particular reason for the mini font size?
eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
Reply
#4
Maybe he wants you to write the code on your own...
B 4 EVER
Reply
#5
I jst copied to word and increased the font size, but forgot to save the file so I wrote it myself anyway
eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
Reply
#6
You can also copy to notepad... I always do that when printing news from a website that has annoying html gimmick stuff..
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#7
Quote:You can also copy to notepad... I always do that when printing news from a website that has annoying html gimmick stuff..
Jep..that's what I do..it's the best solution
B 4 EVER
Reply
#8
or use mozilla. perfect size scaling Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)