Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » Detect if a letter is uppercase
- RedBigz
-
Scratcher
30 posts
Detect if a letter is uppercase
I am writing a hex program and when i convert “paul” to hex it returns as 5041554c when it should return as 7061756c.
Converted, 5041554c outputs PAUL instead of paul because a=A is true. how do i detect if a letter is uppercase?
Converted, 5041554c outputs PAUL instead of paul because a=A is true. how do i detect if a letter is uppercase?
- fdreerf
-
Scratcher
1000+ posts
Detect if a letter is uppercase
<[a] > [A]>This works for all capital letters.
Just replace the capital A with the letter in question.
- nolbarry
-
Scratcher
100+ posts
Detect if a letter is uppercase
What exactly is that supposed to do? Returns false for me no matter the order because a = A in Scratch's arithmetic.<[a] > [A]>This works for all capital letters.
Just replace the capital A with the letter in question.
@OP costumes are case sensitive. If you have a costume named “a”, then
switch costume to (join [A] [])will NOT work. You can use this to detect if a letter is capital by having 26 costumes, all named a different capital letter, plus a bonus costume named anything but a letter.
switch costume to [default v]
switch costume to (letter (x) of (string))
if <(costume [name v] :: looks) = [default]> then
... // letter is lowercase
else
... // letter is uppercase
end
It's tedious but it's the best we got.
Last edited by nolbarry (May 6, 2020 06:00:06)
- fdreerf
-
Scratcher
1000+ posts
Detect if a letter is uppercase
Huh, I tested it, but I might've gotten the results from other things.What exactly is that supposed to do? Returns false for me no matter the order because a = A in Scratch's arithmetic.<[a] > [A]>This works for all capital letters.
Just replace the capital A with the letter in question.
- Discussion Forums
- » Questions about Scratch
-
» Detect if a letter is uppercase