Discuss Scratch

AwesomePerson238243
Scratcher
100+ posts

[ ] contains [ ]?

I have a suggestion for a new block.

name: contains ?
category: sensing
type: Boolean
function: it would scan the first string to see if it contained the second strings input. if it did, it would come out true
block:
< [ ] contains [ ] ? :: sensing Boolean >

people who support (14):
Lythium
DownsGameClub
DaSpudLord
SpongyGames
pvz_pro
theonlygusti
Zekrom01
BurnedCrystal
sheep_maker
alexphan
Bookowl
Prscr
JonathanSchaffer
A-no-meep
Gooballs

people who don't support (0):

Last edited by AwesomePerson238243 (April 22, 2016 19:56:55)

Lythium
Scratcher
1000+ posts

[ ] contains [ ]?

I actually support now, because I can't seem to find a valid workaround.

Last edited by Lythium (April 9, 2016 13:45:33)

AwesomePerson238243
Scratcher
100+ posts

[ ] contains [ ]?

Lythium wrote:

<(answer) = [ whatever]>

Easy workaround.
what is the easy workaround?
DownsGameClub
Scratcher
1000+ posts

[ ] contains [ ]?

Lythium wrote:

<(answer) = [ whatever]>

Easy workaround.

Uhh…. That doesnt work.

Support. But a quick revision
<[] contains []?>::sensing  // The entire block is supposed to be blue...  =/
Since this version of programming is somewhat like a sentence, and saying “if does (answer) contains (blank)”

Last edited by DownsGameClub (April 9, 2016 12:49:46)

Lythium
Scratcher
1000+ posts

[ ] contains [ ]?

DownsGameClub wrote:

Lythium wrote:

<(answer) = [ whatever]>

Easy workaround.

Uhh…. That doesnt work.

Support. But a quick revision
<[] contains []?>::sensing  // The entire block is supposed to be blue...  =/
Since this version of programming is somewhat like a sentence, and saying “if does (answer) contains (blank)”
I realised it after posting.
DaSpudLord
Scratcher
1000+ posts

[ ] contains [ ]?

<[] contains [] ?::sensing>
Support.
SpongyGames
Scratcher
43 posts

[ ] contains [ ]?

Support
pvz_pro
Scratcher
500+ posts

[ ] contains [ ]?

DaSpudLord wrote:

<[] contains [] ?::sensing>
Support.

SpongyGames wrote:

Support
reasons?
semi-support, this has a workaround with variables and lists
theonlygusti
Scratcher
1000+ posts

[ ] contains [ ]?

pvz_pro wrote:

semi-support, this has a workaround with variables and lists
Okay, for the record, here is the work-around:

set [substring found? v] to [false]
set [letters found v] to [0]
set [i v] to [1]
repeat until <<(length of (string)) = ((i)+(1))> or <(substring found?) = [true]>>
set [j v] to [1]
repeat until <<(length of (substring)) = ((j)+(1))> or <(substring found?) = [true]>>
if <(letter (j) of (substring)) = (letter ((i)+((j)-(1))) of (string))> then
change [letters found v] by (1)
end
change [j v] by (1)
end
if <(letters found) = (length of (substring))> then
set [substring found? v] to [true]
end
change [i v] by (1)
end
if <(substring found?) = [true]> then
else
end

As you can see, it is very simple and intuitive, especially for new scratchers.</sarcasm>

I don't see any reason not to support this idea, so, yeah, support!
Zekrom01
Scratcher
1000+ posts

[ ] contains [ ]?

<[] contains []? ::operators>
support
BurnedCrystal
Scratcher
100+ posts

[ ] contains [ ]?

Support, as the workaround can have a considerable effect on performance.

That and I'm sure no one wants to redefine string manipulation functions that already exist in other languages
Sheep_maker
Scratcher
1000+ posts

[ ] contains [ ]?

Support if it's case sensitive.
Scratcher1002
Scratcher
1000+ posts

[ ] contains [ ]?

DownsGameClub wrote:

Lythium wrote:

<(answer) = [ whatever]>

Easy workaround.

Uhh…. That doesnt work.

Support. But a quick revision
<[] contains []? :: sensing>  // The entire block is supposed to be blue...  =/
Since this version of programming is somewhat like a sentence, and saying “if does (answer) contains (blank)”
For the block to be blue you have to put it inside the brackets.
alexphan
Scratcher
1000+ posts

[ ] contains [ ]?

Although you can simply add all of the letters into a list, and then using this:
<[ v] contains [ ]>
It would be very useful for finding substrings.
Support.
BookOwl
Scratcher
1000+ posts

[ ] contains [ ]?

alexphan wrote:

Although you can simply add all of the letters into a list, and then using this:
<[ v] contains [ ]>
It would be very useful for finding substrings.
Support.
That only works if your looking for a single letter…
Support
theonlygusti
Scratcher
1000+ posts

[ ] contains [ ]?

alexphan wrote:

Although you can simply add all of the letters into a list, and then using this:
<[ v] contains [ ]>
It would be very useful for finding substrings.
Support.
That doesn't work.

Only this works:

theonlygusti wrote:

pvz_pro wrote:

semi-support, this has a workaround with variables and lists
Okay, for the record, here is the work-around:

set [substring found? v] to [false]
set [letters found v] to [0]
set [i v] to [1]
repeat until <<(length of (string)) = ((i)+(1))> or <(substring found?) = [true]>>
set [j v] to [1]
repeat until <<(length of (substring)) = ((j)+(1))> or <(substring found?) = [true]>>
if <(letter (j) of (substring)) = (letter ((i)+((j)-(1))) of (string))> then
change [letters found v] by (1)
end
change [j v] by (1)
end
if <(letters found) = (length of (substring))> then
set [substring found? v] to [true]
end
change [i v] by (1)
end
if <(substring found?) = [true]> then
else
end

As you can see, it is very simple and intuitive, especially for new scratchers.</sarcasm>

I don't see any reason not to support this idea, so, yeah, support!
Prscr
Scratcher
100+ posts

[ ] contains [ ]?

<[] contains [] ?::sensing>

I support. I can't find an easy way to workaround this (above seems to have a workaround)
So, final answer,
support!::sensing

Last edited by Prscr (April 9, 2016 21:13:55)

JonathanSchaffer
Scratcher
1000+ posts

[ ] contains [ ]?

support
pvz_pro
Scratcher
500+ posts

[ ] contains [ ]?

Sheep_maker wrote:

Support if it's case sensitive.
the scratch block's strings are not case sensitive
alexphan
Scratcher
1000+ posts

[ ] contains [ ]?

pvz_pro wrote:

Sheep_maker wrote:

Support if it's case sensitive.
the scratch block's strings are not case sensitive
I also defenitely support for that. That would make case detection SO much easier.

Powered by DjangoBB