Feature request: a block to make a string backwards and other text stuff
-
A reporter block that can make text backwards (blue -> eulb) would be useful. The XO assistant works for me now so it isn’t really an issue, but I feel like it’d be better and easier if this were just one reporter block, since it feels like a waste of code to make a whole for-each loop to loop through every single letter and make annoying temporary variables and all that stuff.
I know that these might not be used very often, but other blocks that can transform/encode text would be awesome, like some examples:
- ROT13 encryption: ROT13 is a simple encoding method usually used for fun and puzzles that turns every letter in a string to the 13th letter after it in the English alphabet. This picture explains it well:
Cow:
________________________________________ / Why did the chicken cross the road? \ \ To get to the other side! / ---------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
Tux the Linux penguin mascot:
_________________________________________ / You are only young once, but you can \ \ stay immature indefinitely. / ----------------------------------------- \ \ .--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
And more info about it can be found here: https://en.wikipedia.org/wiki/Cowsay
- Reporter blocks to encode/convert characters for to make them suitable in URLs or specific cases: for example, take a look at https://www.google.com/search?q=creaticode+website . Because URLs can’t handle spaces, they will use a + or another character I forgot. Like when you Google “$”, the $ gets turned into %24 when its in the URL. Having blocks for decoding/encoding in formats like base 64 would also be useful, say if you have the user intentionally upload a “text” file that actually isn’t text and is a .PNG image renamed to .txt and then show the user that image by showing the data URI of that image as the URL in a widget.
- Doing things with words, like finding the dictionary definition(s) of a word and returning it in a table, finding synonyms of the possible meanings of the word and returning a table (ex: “light” would have synonyms regarding weight (portable, lightweight) and ones regarding actual light (luminosity, radiance) ).
-
Thanks for the proposals. We can definitely add these blocks, but we would like to see more upvotes before committing to them.
-
@jeffreyrb03-gmail
I thought Google used %20? -
@catty URLs also use that for a space, but plus is more common (at least for me). It’s just about making it so certain characters work with URLs, which is useful if I’m attempting to get a webpage but I need to append data to the end of its URL, and make sure that it’s valid. I mean the browser does that by default, replacing special characters with their URL-encoding equivalents, but it’s better to stay safe than sorry with some stuff like that.
-
@info-creaticode Thank you! I’ve also found there are more cowsays out there so if cowsay does get added, it would need an option to make your own custom ones, and like tons of others like this:
-
Can you explain what kind of project would make use of the “cowsay” block?
-
@info-creaticode I’m not sure, probably an OS project mocking a Linux terminal? I just think it’d be a fun block to add and it could be displayed in a multiline widget to give fun facts or funny messages
-
@info-creaticode Cowsay is the one suggestion I made that is purely for fun, and is possible using basic Scratch blocks on its own.
However, in terms of people actually using these blocks, I think the ones for turning text backwards and getting dictionary definitions and synonyms of words will be used most and there’s potential to make good educational tutorials out of them.However the ones for encoding (URL, and Base64) would probably be less used. This is because it’s more technical, however those blocks would be very useful for advanced things, mainly for the same reasons or cases that developers using other programming languages would need them. I didn’t include ROT13 because it’s not all that important. Base64 is also not possible using current CreatiCode blocks, and Base64 is important because it’s the only way in the browser to convert binary into just text. For example, you could have the user upload an image, convert that raw file into Base64, and now it’s usable, and just append the file contents to “data:image/png;base64,”, and then lastly, you would show that image back to the user by putting that URL as the image parameter into a widget, and boom, now you are showing an image the user uploaded back to the user using a widget.
-
You know, we should only add blocks that’ll be widely used in many projects, so it doesn’t seem cowsay is a good candidate for that?
-
@info-creaticode that is true
-
@info-creaticode Cowsay is already more than doable using join () () and some linebreaks, so it was a bad suggestion I guess, but things like turning text backwards might be widely used
-
Agreed. We can put that on our list.
-
@jeffreyrb03-gmail
couldn’t you just do this?
-
@catty no, like blue to eulb, not literally
-
-
@catty to do that right now requires a for loop that loops through every character and puts it at the start, but that’s annoying, so I suggested that a block like (reverse text( blue)) is just added so I don’t have to do that
-
@jeffreyrb03-gmail
I should probably start reading more carefully to not make silly mistakes… -
@catty lol were human it happens
-
@catty
oh wait nvm. my brain needs sleep. 🥱 -
@catty this isn’t a chatroom, its still ontopic
-
@catty yeah prolly lol