Discuss Scratch

BoltBait
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

The Scratch language is missing two very important string functions: SubString and Loc.

I have created two projects to demonstrate these functions:

letters1to5ofHello World
https://scratch.mit.edu/projects/154872191/

and

locationofworldwithinHello World
https://scratch.mit.edu/projects/154881971/

Scratch Team, I know these have been requested before… But, it has been a LONG time since the language has been updated with new blocks. Please consider adding these two functions into the language. Thanks!

Last edited by BoltBait (April 25, 2018 04:58:01)

iamunknown2
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

While I support the first suggestion, I'm not so sure about the second one - it would create ambiguity. Does the second block return the location of the first letter or the last letter? Or would it return an entire list?
BoltBait
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

You see, that's why I made a project to demonstrate the functionality. No more ambiguity.

(Plus, if you'd ever used ANY other programming language, you'd already be familiar with these two functions.)
iamunknown2
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

BoltBait wrote:

You see, that's why I made a project to demonstrate the functionality. No more ambiguity.

(Plus, if you'd ever used ANY other programming language, you'd already be familiar with these two functions.)
I'm talking about Scratch newbies - that is, new Scratchers who have no prior experience in any programming language.
WolfCat67
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

I didn't know you were still active! :P
For the first suggestion, I'm afraid that's a duplicate.
For the second suggestion, I think that's a great idea! I could see this being used to separate certain words from others in different ways. And as you've shown, the workaround is not simple at all. Support for that one.

Last edited by WolfCat67 (June 10, 2017 14:28:44)

PullJosh
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

I'd have to agree with iamunknown2. The substring block is pretty intuitive even for new users, and would be incredibly helpful. The location block is also useful, but much less intuitive, so it might not be a great addition (considering Scratch's target audience).
BoltBait
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

considering Scratch's target audience

Worst argument ever.
jromagnoli
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

BoltBait wrote:

considering Scratch's target audience

Worst argument ever.
True… I think the substring block is a duplicate.

Last edited by jromagnoli (April 11, 2017 00:41:58)

BoltBait
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

I think the substring block is a duplicate.

I know.

That's why I originally said…

Scratch Team, I know these have been requested before…
iamunknown2
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

BoltBait wrote:

considering Scratch's target audience

Worst argument ever.
Well, that's actually part of the design goals I think Lightnin posted somewhere here.
ilikelegos
Scratcher
100+ posts

Scratch needs a SubString and Loc functions

Support for substring but maybe not location.
The main downside of either is currently not having them forces new scratchers to learn really important concepts (if they're serious about getting into coding). I probably wouldn't be where I am if we had that functionality. That's a strange argument (Less functionality = better… how???), but may be worth something.

Buuut I agree both would be extremely handy.

Last edited by ilikelegos (June 10, 2017 06:54:17)

kenny2scratch
Scratcher
500+ posts

Scratch needs a SubString and Loc functions

BoltBait wrote:

I think the substring block is a duplicate.

I know.

That's why I originally said…

Scratch Team, I know these have been requested before…
Then why did you make another topic for them? If you know it's been requested before, just go to the original thread and add info there (or if it's closed go to the next oldest one).
XenoCoding
Scratcher
100+ posts

Scratch needs a SubString and Loc functions

Support for both of these. The other day I was thinking about how strange it was that Scratch didn't have a substring block, and how desperately I wanted one. I hope these blocks get implemented in 3.0
Daniel_The_Guy
Scratcher
29 posts

Scratch needs a SubString and Loc functions

BoltBait wrote:

The Scratch language is missing two very important string functions: SubString and Loc.

I have created two projects to demonstrate these functions:

letters1to5ofHello World
https://scratch.mit.edu/projects/154872191/

and

locationofworldwithinHello World
https://scratch.mit.edu/projects/154881971/

Scratch Team, I know these have been requested before… But, it has been a LONG time since the language has been updated with new blocks. Please consider adding these two functions into the language. Thanks!
Support!

WolfCat67 wrote:

I didn't know you were still active! :P
For the first suggestion, I'm afraid that's a duplicate.
For the second suggestion, I think that's a great idea! I could see this being used to separate certain words from others in different ways. And as you've shown, the workaround is not simple at all. Support for that one.
Yes we already have
letter1337ofworld
but we don't have what @BoltBait said,
letters13to37ofworld

PullJosh wrote:

I'd have to agree with iamunknown2. The substring block is pretty intuitive even for new users, and would be incredibly helpful. The location block is also useful, but much less intuitive, so it might not be a great addition (considering Scratch's target audience).

BoltBait wrote:

considering Scratch's target audience

Worst argument ever.
Yes… I agree.
thebrandon
Scratcher
1 post

Scratch needs a SubString and Loc functions

I would like to voice my support for both functions, especially the substring function.

Last edited by thebrandon (July 16, 2017 20:44:55)

badgebry000
Scratcher
24 posts

Scratch needs a SubString and Loc functions

None of these require new scratchers to learn about them, as they will simply use what they know.
elimerl
Scratcher
2 posts

Scratch needs a SubString and Loc functions

None of these require new scratchers to learn about them, as they will simply use what they know.
Yeah, they don't have to use some crazy block. Maybe if it's only available for Advanced Scratchers?
letters1to5ofhello world
bybb
Scratcher
1000+ posts

Scratch needs a SubString and Loc functions

iamunknown2 wrote:

I'm not so sure about the second one - it would create ambiguity. Does the second block return the location of the first letter or the last letter? Or would it return an entire list?
I'll have to disagree with you there, imagine this.
Locationofiinabcdefghijklmnopqrstuvwxyz
It will return 9 because starting at position 9 the string “i” appears, so based on that
Locationofijklmnoinabcdefghijklmnopqrstuvwxyz
Should also return 9 because starting at position 9 the string “ijklmno” appears.
When you ask for the location of something, you want where it starts, not where it ends.

kieranblackley
Scratcher
500+ posts

Scratch needs a SubString and Loc functions

BoltBait wrote:

The Scratch language is missing two very important string functions: SubString and Loc.

I have created two projects to demonstrate these functions:

letters1to5ofHello World
https://scratch.mit.edu/projects/154872191/

and

locationofworldwithinHello World
https://scratch.mit.edu/projects/154881971/

Scratch Team, I know these have been requested before… But, it has been a LONG time since the language has been updated with new blocks. Please consider adding these two functions into the language. Thanks!

I can see a great use for these blocks. For example: If I needed only part of a string I could use this block. Let's say I was importing something like a database into scratch and it came out the wrong way. For example like this:
/hello there./
I only needed the hello there and not the slashes. I could delete the slashes using the substring block.
Great idea! Support.
NitroTyper3000
Scratcher
100+ posts

Scratch needs a SubString and Loc functions

Support! These would make my projects run much faster

Powered by DjangoBB