Discuss Scratch

SonicFanX123_321
Scratcher
1000+ posts

Replace letter () of () with ()

PenguinLover1123 wrote:

redgreenandblue wrote:

I think there should be a
(replace letter () of [] with []::operators)
This would be extremely helpful for variables!
It would show in the block library as
(replace letter (1) of [jello world!] with [h]::operators)
If somebody knows a simple workaround that would also work.
OMEGA SUPPORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! because it's useful

Breck- wrote:

define replace letter (letter) of [text] with [string]
set [i v] to [1]
repeat (length of (text))
add (letter (i) of (text)) to [tmp v]
change [i v] by (1)
end
replace item (letter) of [tmp v] with (string)
set [result v] to (tmp :: list)
it's a stack, not a reporter
you can use block and then use result variable
6d66yh
Scratcher
100+ posts

Replace letter () of () with ()

Breck- wrote:

define replace letter (letter) of [text] with [string]
set [i v] to [1]
repeat (length of (text))
add (letter (i) of (text)) to [tmp v]
change [i v] by (1)
end
replace item (letter) of [tmp v] with (string)
set [result v] to (tmp :: list)
Ah yes, linear complexity array writes. Seriously, there should be native integer arithmetic in Scratch.
BossBoss2011
Scratcher
4 posts

Replace letter () of () with ()


I aggree,
() contains []
should exist!


define I aggree!
broadcast [I aggree!] to the world

Last edited by BossBoss2011 (Jan. 14, 2022 14:40:53)

Myst--
Scratcher
100+ posts

Replace letter () of () with ()

Semi-Support. There is a workaround but I wouldn't call it an easy one lol.

Last edited by Myst-- (Jan. 14, 2022 16:34:31)

qloakonscratch
Scratcher
1000+ posts

Replace letter () of () with ()

CodeLegend wrote:

No support. Not because there's a workaround (most existent blocks in Scratch have a workaround), but because its potential applications are limited. It could also confuse newer coders. They could try this:
(replace letter (1) of (my variable) with [a]::operators)
thinking that it would modify the variable.
Rework of it:

(replace (1) of (my variable) with [a]::operators)

If my variable was 1, it would report 1. 923.4 would report 9.
Jackson49_test
Scratcher
100+ posts

Replace letter () of () with ()

Bump
A-KouZ1
Scratcher
100+ posts

Replace letter () of () with ()

ScratchCat8464 wrote:

A-KouZ1 wrote:

More logic blocks
set [mytext v] to [there's is manyyyyyyyyyyyyy typos here]
replace letter between (16) to (27) with [] of (mytext)//if u want remove a letter lol
set [mytext v] to (output::list)



define replace letter between (least) to (most) with (new) of (string)
delete [all v] of [output v]
set [i v] to [0]
repeat ((least)-(1))
change [i v] by (1)
add (letter (i) of (string)) to [output v]
end
set [i v] to [0]
repeat ((most)-(least))
change [i v] by (1)
add (letter (i) of (new)) to [output v]
end
set [i v] to ((most)+(1))
repeat ((length of (string))-(most))
change [i v] by (1)
add (letter (i) of (string)) to [output v]
end
easiest method:
define replace letter between (least) to (most) with (new) of (string)
set [output v] to []
set [count v] to [0]
repeat (length of (string))
change [count v] by (1)
if <(count) = (least)> then
set [output v] to (join (output) (new))
else
if <not <<((least) - (1)) < (count)> and <((most) + (1)) > (count)>>> then
set [output v] to (join (output) (letter (count) of (string))
end
end
end

replace letter between (4) to (6) with [] of [easiwyy!]
say (output)
//output = easy!
i hate scratch 3's 200k list limit
LAVEna_THe_NicE_Guy
Scratcher
54 posts

Replace letter () of () with ()

This might be cooler
(Replace [] with [] in []:: reporter operators)
Who can make this

Last edited by LAVEna_THe_NicE_Guy (Aug. 17, 2022 23:50:20)

LAVEna_THe_NicE_Guy
Scratcher
54 posts

Replace letter () of () with ()

chrdagos wrote:

This is a interesting idea. Such block will allow for things like spell checking in projects.
(I like this idea)
wow cool block

Last edited by LAVEna_THe_NicE_Guy (Aug. 26, 2022 11:36:46)

LAVEna_THe_NicE_Guy
Scratcher
54 posts

Replace letter () of () with ()

LAVEna_THe_NicE_Guy wrote:

chrdagos wrote:

This is a interesting idea. Such block will allow for things like spell checking in projects.
(I like this idea)
Rejected Boolean event block
actually the signature I gues
Creator-H
Scratcher
100+ posts

Replace letter () of () with ()

Not really helpful, look at the workaround at the first page
LAVEna_THe_NicE_Guy
Scratcher
54 posts

Replace letter () of () with ()

bump
spocite
Scratcher
500+ posts

Replace letter () of () with ()

complete support. there are definitely workarounds, but this would be miles better as its easier (there isn't an operator version of the custom scripts), and its faster!
-ErrorPurpl_157
Scratcher
100+ posts

Replace letter () of () with ()

Breck- wrote:

-snip-
It's better than this method:
define change (character#) of string to (new character)
set [changer v] to []
set [item# v] to (1)
repeat ((character#) - (1))
set [changer v] to (join (changer) (letter (item#) of (string)))
change [item# v] by (1)
end
set [changer v] to (join (changer) (new character))
set [item# v] to ((character#) + (1))
repeat ((length of (string)) - (character#)
set (changer) to (join (changer) (letter (item#) of (string)))
change [item# v] by (1)
end
set [string v] to (changer
*internal screaming*
-ErrorPurpl_157
Scratcher
100+ posts

Replace letter () of () with ()

BossBoss2011 wrote:

I aggree,
<() contains [] :: operators>
should exist!
-snip-
It exists, check the editor
AndrewB1501
Scratcher
500+ posts

Replace letter () of () with ()

-ErrorPurpl_157 wrote:

BossBoss2011 wrote:

I aggree,
<() contains [] :: operators>
should exist!
-snip-
It exists, check the editor
It didn't exist until 3.0, and that is a post from 2.0. It wasn't there back then, but it is now.
medians
Scratcher
1000+ posts

Replace letter () of () with ()

AndrewB1501 wrote:

-ErrorPurpl_157 wrote:

BossBoss2011 wrote:

I aggree,
<() contains [] :: operators>
should exist!
-snip-
It exists, check the editor
It didn't exist until 3.0, and that is a post from 2.0. It wasn't there back then, but it is now.
Can confirm, person with the same profile picture as me.
Anyway, maybe these blocks alongside this?
(index of [t] in [string] ::operators)
(index of [thing] in [list v] ::list)

Last edited by medians (June 2, 2023 18:09:49)

-OdysseyCentral-
Scratcher
1000+ posts

Replace letter () of () with ()

No support. Usually I wouldn’t put “no support” just because of a workaround, but the workaround isn’t that hard imo and it’s one of the workarounds I personally enjoyed finding, and I usually don’t enjoy working around non-existing blocks, but this one is really cool.
IHEL-
Scratcher
2 posts

Replace letter () of () with ()

ah
d
IHEL-
Scratcher
2 posts

Replace letter () of () with ()

oldest most relevant topic
think [:)] for (2) secs

Powered by DjangoBB