プレイ日記
Aaron Krondelo
@Oscar, Help! I need your expertise. How can I ask for an input of a binary string, then convert that into an array for each bit? The problem is using the length as a $tring isn't compatible with integers!
2そうだね
プレイ済み
返信[1]
親投稿
Gale Storm GaleTheStorm
When you say "binary string" what do you mean?
0そうだね
プレイ済み
返信[2]
親投稿
raimondz raimondxz
Is Size$ a binary inside an string(Example "1101")? If that is the case, then I think that you should do this on line 10: BIT[I]=VAL(SIZE$[I])
1そうだね
プレイ済み
返信[3]
親投稿
Aaron Krondelo
Hmm, I did'nt know about the VAL command. I just want to ask for an unfixed length binary .. number, ie:(10101 OR 0110), then it turns that into BIT[0]=1:BIT[1]=0 and so forth.
0そうだね
プレイ済み
返信[4]
親投稿
raimondz raimondxz
Now I understand. You wanted to trim the "0" from the left side. There is an easy way to have an string with exact length of a binary. Try this: SIZE$=BIN$(VAL("&B"+SIZE$)) ? LEN(SIZE$) The code above is used to get the string without the 0 at the left side. The text &B at the begining of the argument is used to identify the string as a binary.
0そうだね
プレイ済み
返信[5]
親投稿
Aaron Krondelo
Ok, I don't want to trim anything off, but you probably thought that because of LEFT$. Thankyou though maybe I can get it now.
0そうだね
プレイ済み
返信[6]
親投稿
Oscar PwnageBlock
I'm sorry for not answering. I see you've gotten some help already, but I think I can still contribute a bit. :) If you want an array that holds each bit from a binary string, without trimming any leading zeroes, you could make something like this... DIM BNRY[0] FOR I=0 TO LEN(ST$)-1 PUSH BNRY,VAL(ST$[I]) NEXT Just make sure to validate that the string only contains binary digits.
1そうだね
プレイ済み
返信[7]
親投稿
Aaron Krondelo
Thanks that is exactly what I needed.
0そうだね
プレイ済み