Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Cloud Data Supporting Only Numbers
- JAVAProgramming
- Scratcher
100+ posts
Cloud Data Supporting Only Numbers
How would I split two numbers up if I don't know exactly how long the number is?
I thought using “•” would fool Scratch. but no, then I tried “,”, but that still didn't work. Does anyone have an idea?
I thought using “•” would fool Scratch. but no, then I tried “,”, but that still didn't work. Does anyone have an idea?
My Newest Project, Come Check It Out
Dots, On Scratch
Want to change the way we count? The Dozenal System.
“The story so far:
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.”
― Douglas Adams, The Restaurant at the End of the Universe
- drmcw
- Scratcher
1000+ posts
Cloud Data Supporting Only Numbers
If you mean you have a number that is 2 numbers concatenated and each number is of varying length then you can't split the numbers. You need to either fix the length and pad with zeros or insert a fixed length number that provides the length of the following number so for example using a single digit fixed length counter, the concatenation of the numbers 100 and 123456 would be;
31006123456 so decoding you'd read the first digit 3 which means the next number is 3 characters long = 100 then fixed length counter = 6 so next number = 123456
31006123456 so decoding you'd read the first digit 3 which means the next number is 3 characters long = 100 then fixed length counter = 6 so next number = 123456
- sonicfan12p
- Scratcher
1000+ posts
Cloud Data Supporting Only Numbers
Well, a possible spacer is the number 0. However, you could also encode in twos. 34720698 is separated into 34 72 06 98. That fixes length, to some degree. But using the first two digits to tell you how long the next word is is also very useful. The script is rather long to post here though…
Comeback time? Maybe?
- JAVAProgramming
- Scratcher
100+ posts
Cloud Data Supporting Only Numbers
I don't know exactly how many digits, and what digits are in the number. Well, a possible spacer is the number 0. However, you could also encode in twos. 34720698 is separated into 34 72 06 98. That fixes length, to some degree. But using the first two digits to tell you how long the next word is is also very useful. The script is rather long to post here though…
My Newest Project, Come Check It Out
Dots, On Scratch
Want to change the way we count? The Dozenal System.
“The story so far:
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.”
― Douglas Adams, The Restaurant at the End of the Universe
- JAVAProgramming
- Scratcher
100+ posts
Cloud Data Supporting Only Numbers
The numbers will have both 0's and 9's in them. So that won't work. Use 0 to separate each digit of a number and 9 to separate each hole number and have it turn zeros into 11s and nines into 12s
My Newest Project, Come Check It Out
Dots, On Scratch
Want to change the way we count? The Dozenal System.
“The story so far:
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.”
― Douglas Adams, The Restaurant at the End of the Universe
- Discussion Forums
- » Help with Scripts
- » Cloud Data Supporting Only Numbers