トピック
Caleb caleb.devontx

String input to Character array

I know in popular programming languages like java, c++, etc. there ways to turn strings and string inputs into an array of characters (ex. "Hello World" -> ["H","e","l","l","o"," ","W","o","r","l","d"] a representation of Hello World in Char[] form)
0そうだね
プレイ済み
返信[1]
親投稿
Aaron Krondelo
You could do it manually. I'm sure one of the SB experts will chime in with the best way, but hang on and I'll try and work it out.
0そうだね
プレイ済み
返信[2]
親投稿
Aaron Krondelo
So, a bit difficult fo find/figure out the best command for extracting the characters. It may be LEFT$. However, this here works except its converting the string value to integers. If you can change that part then voila!
0そうだね
プレイ済み
返信[3]
親投稿
Caleb caleb.devontx
I actually found a way too, what I didn't realize is that the pop method works on a regular string, not just arrays
0そうだね
プレイ済み
返信[4]
親投稿
Aaron Krondelo
Oh wow, I thought POP was only for arrays too. Interesting.
0そうだね
プレイ済み
返信[5]
親投稿
Autz sonic-HD8765
A string behaves like an array, that's why you can access to a specific character of a string by using []. Example: String$[3] BUT BE CAREFUL: Using array operators on string will cause a Memory Leak, which can only be fixed by restarting SB.
1そうだね
プレイ済み
返信[6]
親投稿
Caleb caleb.devontx
What happens in a memory leak?
0そうだね
プレイ済み
返信[7]
親投稿
Autz sonic-HD8765
Means that memory is misplaced and you can't access to it no matter what. Since you start with 8MB of memory available, you won't notice it if you run a small program with that bug. But if your program is big and running from quite some time, you will eventually get a Out of Memory error.
0そうだね
プレイ済み
返信[8]
親投稿
Caleb caleb.devontx
Oh
0そうだね
プレイ済み