I'm trying to turn a string into a number, but apparently Scratch ignores the case when returning the list item of a string. So, how would I make it so that scratch pays attention to the case when giving me the letter's corresponding number?
Asked
Active
Viewed 593 times
5

Coarse Rosinflower
- 85
- 1
- 15
-
Scratch is basically not case-sensitive. – IsaacRoan Sison Dec 15 '21 at 06:53
-
4The Scratch wiki has [this article](https://en.scratch-wiki.info/wiki/Case_Sensing) about case sensing. Depending on the outcome, you can add 32 to the ASCII code to go from uppercase to lowercase. – Ruud Helderman Dec 16 '21 at 11:03
-
Havnt used scratch in a while but you can probably do something like – KingTasaz Apr 03 '22 at 03:03
-
`if s.upper() == s: print("its uppercase")` – KingTasaz Apr 03 '22 at 03:03
-
@KingTasaz yes, but this is Scratch, and doesn't have a native `string.isUpper()` function. – Coarse Rosinflower Aug 05 '22 at 15:59
1 Answers
1
The "set costume to (name)" block is case sensitive, so it should solve your problem.
It looks like you are attempting to convert a ASCII character into a number. You can implement this with the following steps:
Create around 90 costumes with the different ASCII characters you want to use.
Then use "set costume to (queried character)" block found in the looks tab.
The "(costume number)" variable (found in the looks tab) will be your output number.
If you want to convert this a number back into ASCII you can use the following steps:
- Make sure you have the special costumes from step 1
- Use "set costume number to (number)".
- The "(costume name)" variable (found in the looks tab) will be the original character.
The only obvious downside to using this method is that encoding or decoding will change the current costume of the sprite, so I usually make a separate sprite if I want to use costumes.

Ayden Horne
- 36
- 2