Discuss Scratch
- Discussion Forums
- » Suggestions
- » A uppercase/ lowercase block
- Caleb101
-
Scratcher
100+ posts
A uppercase/ lowercase block
It would be great to have a block that changes the input into all lowercase or uppercase.
- DaSpudLord
-
Scratcher
1000+ posts
A uppercase/ lowercase block
Semi-support, while I believe it exists in other languages, I feel it might be underused- and by that I mean it won't be very useful, especially considering Scratch is not case-sensitive. If you need it, though, there are workarounds, but they can be a bit tedious.
- awesome-llama
-
Scratcher
1000+ posts
A uppercase/ lowercase block
I was thinking about the same suggestion a few hours ago 
Well anyway, this would be nice for my project since it needs to be lowercase for minecraft commands, except would not be used that much in other projects.
So… no support

Well anyway, this would be nice for my project since it needs to be lowercase for minecraft commands, except would not be used that much in other projects.
So… no support
Last edited by awesome-llama (Dec. 17, 2015 09:32:34)
- LastAttack1257
-
Scratcher
100+ posts
A uppercase/ lowercase block
Semi-support, while I believe it exists in other languages, I feel it might be underused- and by that I mean it won't be very useful, especially considering Scratch is not case-sensitive. If you need it, though, there are workarounds, but they can be a bit tedious.Semi - support - for this reasaon ^
- Prinseskat
-
Scratcher
1000+ posts
A uppercase/ lowercase block
define convert (string) to (upper/lower) case
set [new string v] to [] //will return string converted to upper/lower case
set [i v] to [1]
repeat (length of (string)) //loop through string
set [j v] to [1]
repeat until << (letter (j) of [abcdefghijklmnopqrstuvwxuz]) = (letter (i) of (string)) > or < (j) > [26] >>
change [j v] by (1) //loop through alphabet until letter is found
end
if < (j) > [26] > //if it is not in alphabet
set [new string v] to (join (new string) (letter (i) of (string))
else
if <(upper/lower) = [upper]>
set [new string v] to (join (new string) (letter (j) of [ABCDEFGHIJKLMNOPQRSTUVWXYZ]) //add uppercase version to new string
end
if <(upper/lower) = [lower]>
set [new string v] to (join (new string) (letter (j) of [abcdefghijklmnopqrstuvwxuz]) //add lowercase letter to string
end
end
change [i v] by (1) //on to next letter in string!
end
- Seth_Zaw
-
Scratcher
100+ posts
A uppercase/ lowercase block
Well, what if Turkish scratchers wanted to use that block? (In Turkish, I's lowercase is ı, and i's uppercase is İ)
- ILikeScratch0-0-0-1
-
Scratcher
27 posts
A uppercase/ lowercase block
define convert (string) to (upper/lower) case
set [new string v] to [] //will return string converted to upper/lower case
set [i v] to [1]
repeat (length of (string)) //loop through string
set [j v] to [1]
repeat until << (letter (j) of [abcdefghijklmnopqrstuvwxuz]) = (letter (i) of (string)) > or < (j) > [26] >>
change [j v] by (1) //loop through alphabet until letter is found
end
if < (j) > [26] > then //if it is not in alphabet
set [new string v] to (join (new string) (letter (i) of (string))
else
if <(upper/lower) = [upper]> then
set [new string v] to (join (new string) (letter (j) of [ABCDEFGHIJKLMNOPQRSTUVWXYZ]))//add uppercase version to new string
end
if <(upper/lower) = [lower]> then
set [new string v] to (join (new string) (letter (j) of [abcdefghijklmnopqrstuvwxuz])) //add lowercase letter to string
end
end
change [i v] by (1) //on to next letter in string!
end
Last edited by ILikeScratch0-0-0-1 (Oct. 6, 2020 19:20:50)
- Conniepoo
-
Scratcher
3 posts
A uppercase/ lowercase block
There is a much simpler way to capitalize and lowercase strings in scratch.
This just loops 26 times for each letter in the string to determine what letter it is, and then it translates it to a corresponding letter in either lowercase or uppercase. In the image it is a lowercase version. Change the second visible alphabet to all caps if you want upper case, or to anything you want to correspond to the different letters of the alphabet.
This just loops 26 times for each letter in the string to determine what letter it is, and then it translates it to a corresponding letter in either lowercase or uppercase. In the image it is a lowercase version. Change the second visible alphabet to all caps if you want upper case, or to anything you want to correspond to the different letters of the alphabet.
set (Password) to [PaSSWoRd]
set (Letter) to [1]
set (Password2) to []
repeat (length of (Password))
repeat (26)
if <(letter (Letter) of (Password)) = (letter (Iterations) of [abcdefghijklmnopqrstuvwxyz])> then
set (Password2) to (join (Password2) (letter (Iterations) of [abcdefghijklmnopqrstuvwxyz]))
end
change (Iterations) by (1)
end
change (Letter) by (1)
set (Iterations) to [1]
end
say (Password2) for (2) secs
say [password]
Last edited by Conniepoo (Oct. 21, 2020 03:48:14)
- dhfbei8987
-
Scratcher
1000+ posts
A uppercase/ lowercase block
Bump. This would be useful if there's codes, all caps, lowercase stuff, etc.
- Discussion Forums
- » Suggestions
-
» A uppercase/ lowercase block