Discuss Scratch
- superscratch444tre
-
Scratcher
45 posts
( replace [ ] by [ ] in [ ] ) 》operator
Hello everybody! I have a helpful suggestion for scratch. As you probably read in the title, it would be an operator that replaces characters. It would be something like this:
and an:
Example:
Please support if you would like it!!
(replace all[]with[]in[]::operators)
and an:
(replace #()instance of[]with[]in[]::operators)
Example:
(replace all[po]with[pe]in[typo]::operators)//The value would be equal to "type".
(replace all[p]with[m]in[pind]::operators)//The value would be equal to "mind".
(replace all[i]with[9]in[car]::operators)//The value would be equal to "car".
(replace all[i]with[]in[hellio]::operators)//The value would be equal to "hello".
(replace all[9]with[llo]in[he9]::operators)//The value would be equal to "hello".
(replace all[8]with[l]in[he88o]::operators)//The value would be equal to "hello".
(replace #(1)instance of[w]with[o]in[hellw world]::operators)//The value would be equal to "hello world".
Please support if you would like it!!

Last edited by superscratch444tre (March 19, 2021 13:23:19)
- Seth_Zaw
-
Scratcher
100+ posts
( replace [ ] by [ ] in [ ] ) 》operator
What happens in these occasions?
replace [d] by [i] in [bag] :: operators reporter
replace [h] by [p] in [pappy] :: operators reporter
- PkmnQ
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
What happens in these occasions?replace [d] by [i] in [bag] :: operators reporter
replace [h] by [p] in [pappy] :: operators reporter
1. Returns bag.
2. Returns hahhy.
- Vibrato
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
how about
(replace[]with[]in[]::operators)so it's easier to understand
- superscratch444tre
-
Scratcher
45 posts
( replace [ ] by [ ] in [ ] ) 》operator
how aboutYes, true.(replace[]with[]in[]::operators)so it's easier to understand
- superscratch444tre
-
Scratcher
45 posts
( replace [ ] by [ ] in [ ] ) 》operator
how aboutI have changed it!(replace[]with[]in[]::operators)so it's easier to understand
Last edited by superscratch444tre (Sept. 9, 2020 09:03:27)
- Vibrato
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
#supportplease say why you support
- ipaddude
-
Scratcher
100+ posts
( replace [ ] by [ ] in [ ] ) 》operator
support
i guess
but can you delete characters by replacing with nothing?
could you add characters?
could you replace multiple characters?
what if i only want to replace the first or second or third or so on instance of a substring in a string?
can there be this block?
i guess
but can you delete characters by replacing with nothing?
(replace[e]with[]in[typoe]::operators)(returns typo - ?)
could you add characters?
(replace[g]with[po]in[tyg]::operators)(returns typo - ?)
could you replace multiple characters?
(replace[op]with[po]in[tyop]::operators)(returns typo - ?)
what if i only want to replace the first or second or third or so on instance of a substring in a string?
can there be this block?
(replace #(1)instance of[w]with[o]in[hellw world]::operators)(returns hello world - ?)
- superscratch444tre
-
Scratcher
45 posts
( replace [ ] by [ ] in [ ] ) 》operator
support1: Yes, 2: yes, 3: yes, and 4: good Ideea! I will add it!
i guess
but can you delete characters by replacing with nothing?(replace[e]with[]in[typoe]::operators)(returns typo - ?)
could you add characters?(replace[g]with[po]in[tyg]::operators)(returns typo - ?)
could you replace multiple characters?(replace[op]with[po]in[tyop]::operators)(returns typo - ?)
what if i only want to replace the first or second or third or so on instance of a substring in a string?
can there be this block?(replace #(1)instance of[w]with[o]in[hellw world]::operators)(returns hello world - ?)

Last edited by superscratch444tre (Sept. 9, 2020 13:15:54)
- sonic__fan
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
This seems confusing. Could you please explain?
- PkmnQ
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
This seems confusing. Could you please explain?it replace first thing with second thing in the third thing
e.g.
(replace [,] with [.] in [7,6 billion] :: operators) // useful for european numbers
Last edited by PkmnQ (May 6, 2021 01:25:03)
- cs369396
-
Scratcher
100+ posts
( replace [ ] by [ ] in [ ] ) 》operator
Support, but not the instance #. How about, by default, it only does the first instance and you can add a loop to keep doing it:
when green flag clicked
set [temp v] to []
set [string v] to [elemental]
repeat until <(temp) = (string)>
set [temp v] to (string)
set [string v] to (replace [e] with [a] in (string) :: operators)
end
Last edited by cs369396 (May 6, 2021 01:37:42)
- PkmnQ
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
Support, but not the instance #. How about, by default, it only does the first instance and you can add a loop to keep doing it:I'd wait for custom reporters to do that workaroundwhen green flag clicked
set [temp v] to []
set [string v] to [elemental]
repeat until <(temp) = (string)>
set [temp v] to (string)
set [string v] to (replace [e] with [a] in (string) :: operators)
end
- qloakonscratch
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
Support. This would make it a lot easier to make decoders, at least for me. Also, I think it should be a block. Or both.
replace (text) with <(abc_list) = (pick random (1) to (36))> in (text) ::operatorsOr..
(replace (text) with <(abc_list) = (pick random (1) to (36))> in (text) ::operators)
<(text)= [Support.]>
- Aadish_1759
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
Support as once I had to replace a word in a list of 360 length.
- vudeptrai090211
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
support, this could be useful in a game.
example:
example:
(replace [0] with [1] in [000]::operators)question: but what if i want to set that number to 010?
Last edited by vudeptrai090211 (Feb. 6, 2022 04:43:57)
- Aadish_1759
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
(#18)It would be -
but i have a question
what if i want to change it to “dodge”?(replace [d] with [t] in [dotge]::operators)
(replace [t] with [d] in [dotge]::operators)
- vudeptrai090211
-
Scratcher
1000+ posts
( replace [ ] by [ ] in [ ] ) 》operator
It would be -how about “tag”?(replace [t] with [d] in [dotge]::operators)
(replace [] with [] in [tat]::operators)
Last edited by vudeptrai090211 (Feb. 6, 2022 04:46:40)











