Discuss Scratch
- -Kryptonite-
-
1000+ posts
split blocks
More uses for this block can be:
\
- Breaking down saving codes
Getting first/last name
breaking down long strings/integers
making a sentence a list of words
Support, these reasons are why ^^
- mitdk
-
1000+ posts
split blocks
bump, pretty much the whole page is bumps

Last edited by mitdk (July 12, 2021 23:11:14)
- HTML_JAVASCRIPT_CSS
-
100+ posts
split blocks
I support. This would be useful.
However, there is a possible workaround.
Note: There is a mistake. You can find the fixed post here: https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/post/5438387/
(section (2) of [x,y,z] on [,] :: operators) // returns y
However, there is a possible workaround.
define var = section (x) of [y] on [z]Then you can get the result from the variable “var”.
set [start v] to [1]
set [part v] to [1]
set [length v] to (length of (y))
set [str v] to []
repeat until <(start) > (length)>
set [char v] to (letter (start) of (y))
if <(char) = (z)> then
if <(part) = (x)> then
set [var v] to (str)
stop [this script v]
end
change [part v] by (1)
set [str v] to []
else
set [str v] to (join (str)(char))
end
end
Note: There is a mistake. You can find the fixed post here: https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/post/5438387/
Last edited by HTML_JAVASCRIPT_CSS (July 16, 2021 00:24:02)
- lapisi
-
1000+ posts
split blocks
I support. This would be useful.that is an extremely complex workaround(section (2) of [x,y,z] on [,] :: operators) // returns y
However, there is a possible workaround.define var = section (x) of [y] on [z]Then you can get the result from the variable “var”.
set [start v] to [1]
set [part v] to [1]
set [length v] to (length of (y))
set [str v] to []
repeat until <(start) > (length)>
set [char v] to (letter (start) of (y))
if <(char) = (z)> then
if <(part) = (x)> then
set [var v] to (str)
stop [this script v]
end
change [part v] by (1)
set [str v] to []
else
set [str v] to (join (str)(char))
end
end
- HTML_JAVASCRIPT_CSS
-
100+ posts
split blocks
i knowI support. This would be useful.that is an extremely complex workaround(section (2) of [x,y,z] on [,] :: operators) // returns y
However, there is a possible workaround.define var = section (x) of [y] on [z]Then you can get the result from the variable “var”.
set [start v] to [1]
set [part v] to [1]
set [length v] to (length of (y))
set [str v] to []
repeat until <(start) > (length)>
set [char v] to (letter (start) of (y))
if <(char) = (z)> then
if <(part) = (x)> then
set [var v] to (str)
stop [this script v]
end
change [part v] by (1)
set [str v] to []
else
set [str v] to (join (str)(char))
end
end
this is why i support
- HTML_JAVASCRIPT_CSS
-
100+ posts
split blocks
I realized there was a mistake, here is the correct one:
define var = section (x) of [y] on [z]You can get the code here: https://scratch-mit-edu.ezproxyberklee.flo.org/projects/553597617
set [start v] to [1]
set [part v] to [1]
set [length v] to (length of (y))
set [str v] to []
repeat until <(start) > (length)>
set [char v] to (letter (start) of (y))
if <(char) = (z)> then
if <(part) = (x)> then
set [var v] to (str)
stop [this script v]
end
change [part v] by (1)
set [str v] to []
else
set [str v] to (join (str)(char))
end
change [start v] by (1)
end
- SonicFanX123_321
-
1000+ posts
split blocks
ah, so like this?

(in Squeak Smalltalk)output:

(in Squeak Smalltalk)
'Hello!' findTokens: 'l'
(OrderedCollection) 'He','o!'
- Mrcakeyman89
-
1000+ posts
split blocks
Support. This would be really interesting, and helpful. I don't see how this would be too complicated for new scratchers as most new scratchers joining are younger and probabbly don't understand algebra and so don't understand those blocks but they're still in xD
I think it'd be smarter to have some sort of built in seperator, as scratchers have to fully know how to use it to… well… use it. As well as the fact that you can't have both text and a boolean in a text/boolean port. If we had it like the “Join” script, then we can layer it, while still having the same idea. Kinda like what SonicFanX123_321 showed here.
Thanks for Suggesting!
Scratch On!
I think it'd be smarter to have some sort of built in seperator, as scratchers have to fully know how to use it to… well… use it. As well as the fact that you can't have both text and a boolean in a text/boolean port. If we had it like the “Join” script, then we can layer it, while still having the same idea. Kinda like what SonicFanX123_321 showed here.
Thanks for Suggesting!

Scratch On!
Last edited by Mrcakeyman89 (July 31, 2021 18:37:49)