Discuss Scratch

codeman1044
Scratcher
1000+ posts

letter # of () in ()

Anybody like this? The block would look like this:
(letter # of () in ()::operators) 
And it would function kind of like this:
(item # of () in [list v]::list) 
Where it would return a number based on the position of the letter in a string. For example:
(letter # of [a] in [scratch]::operators) 
would return 4.
Support?

This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
14152cool
Scratcher
100+ posts

letter # of () in ()

support, if it doesn't fart itself upon an input like this:
(letter # of [c] in [scratch]::operators)

Annoyingly, my signature was eaten by a small, white dog. How annoying.




Tallented-Code-bot
Scratcher
100+ posts

letter # of () in ()

What would happen if either the letter you were asking about did not exist, or if it happened more than once. if the letter happened more than once,ll
would it output something like this: 1,3,5, or would it return an error? If the letter did not exist, would it output 0?

Last edited by Tallented-Code-bot (May 18, 2019 15:53:40)

Za-Chary
Scratcher
1000+ posts

letter # of () in ()

14152cool wrote:

support, if it doesn't fart itself upon an input like this:
(letter # of [c] in [scratch]::operators)
If it works anything like the list version does, this block would return “2” because it's the first instance of “c” that is used in that string.

Tallented-Code-bot wrote:

What would happen if either the letter you were asking about did not exist, or if it happened more than once. if the letter happened more than once,ll
would it output something like this: 1,3,5, or would it return an error? If the letter did not exist, would it output 0?
It would just output the first instance, I think. If it did not exist, it might return 0 — what does the list version do?

This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.

I was a Scratch Team member from May 10th 2019 to October 29th 2021.

my notebook | scratch team essay | accessibility essay
codeman1044
Scratcher
1000+ posts

letter # of () in ()

The list version returns 0, which really helpful sometimes when you're using code that waits until the item # of something isn't 0.

This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
coder2045
Scratcher
1000+ posts

letter # of () in ()

What would these return?
(letter # of (e) in [world]::operators)
(letter # of (e) in [NilsTheBest]::operators)
(letter # of (foo) in [abc123abc]::operators)

Highlight this text and press Ctrl-Shift-Down to view more of my signature. There's a lot in there.
I FOUND THE POSTIE POSTIE POST LINK THIS
Brainteaser: What comes next? Answer on my profile. First correct answer gets a follow.

[ ]
[ [ ] ]
[ [ [ ] ] [ ] ]
Good projects ⬇️




StrangeMagic32
Scratcher
1000+ posts

letter # of () in ()

coder2045 wrote:

What would these return?
(letter # of (e) in [world]::operators)
(letter # of (e) in [NilsTheBest]::operators)
(letter # of (foo) in [abc123abc]::operators)
0
7
if foo = a, b, c, 1, 2, or 3, then it would be 1, 2, 3, 4, 5, or 6

Last edited by StrangeMagic32 (May 23, 2019 22:36:25)



“Remember the worth of souls is great in the sight of God;”
- Doctrine and Covenants 18:10


I have since moved to @JollyWinter
codeman1044
Scratcher
1000+ posts

letter # of () in ()

StrangeMagic32 wrote:

0
7
if foo = a, b, c, 1, 2, or 3, then it would be 1, 2, 3, 4, or 5
You missed 6 for the c.
sorry, I had to.

This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
StrangeMagic32
Scratcher
1000+ posts

letter # of () in ()

codeman1044 wrote:

StrangeMagic32 wrote:

0
7
if foo = a, b, c, 1, 2, or 3, then it would be 1, 2, 3, 4, or 5
You missed 6 for the c.
sorry, I had to.
oops, thanks xD


“Remember the worth of souls is great in the sight of God;”
- Doctrine and Covenants 18:10


I have since moved to @JollyWinter
BosenChang
Scratcher
1000+ posts

letter # of () in ()

Wow, support! This would help scratch projects a lot!

Last edited by kaj (The day after tomorrow 01:01:01)
Tomatoes are salty? I didn't know that!
Be moist
(-!*o_o*!-) // protecty, my signature kumquat protector. *power level: infinty *magic level: infinty
(?-i_i-?) // claculately, caculates weaknesses and finds out strengths to...
// evil qumquats



My signature change:
Some people don't have empathy; while others do.
Some people false-report projects, and more necropost.

Hello there! I can sometimes help you, or you can help me!


See my projects
I am not advertising. This is a signature. It appers underneath everything I write! To change your signature, go to Discussion Home and scroll down to “change my signature.”
see my projects::looks
say [hello]
If you want to see my topic “What makes a good topic?”, then go to Which topics are good?
Other helpful:
Lists of suggestions by SSB20 *please call him by his nickname*
Which topics are good? (already included) by me
Cooorupt
Scratcher
25 posts

letter # of () in ()

SpacePirate80 wrote:

This is pretty cool. It would be helpful but it's fairly easy to work around.

define Find letter # of (char) in (string)
set [ i] to [1]
repeat (length of (string))
if <(letter (i) of (string)) = (char)> then
set [location of char in string] to (i)
stop [ this script]
end
change [i] by (1)
end

I tested it and it works perfectly everytime. It only works if you only put in one character. (I couldn't get
(char)
and
(string)
to become purple so just pretend they are)
Although, it would be pretty nice just to have a block to do that for us.

Thanks for the workaround!

I don't know what to put on the forums, so… here's a dancing Sad Cube.

Enjoy that for a while, then hopefully I can figure out something…
codeman1044
Scratcher
1000+ posts

letter # of () in ()

I completely forgot I had made this post. This is over a year old!
The workaround works fine, but it isn't directly a reporter. When I made this, I was thinking of something like this:
Set [foo2 v] to (letter # of (foo1) in (answer)::operators)
instead of
Find letter # of (foo1) in (answer)::custom
Set [foo2 v] to (location of char in string)
Not much of an inconvinience, but it would be like having the (item # of () in ()) reporter compared to not having it, so it would still be nice.

This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
Seth_Zaw
Scratcher
100+ posts

letter # of () in ()

Duplicate

¡Aprendamos español con los Alfabetons!
In my new series, you will cover genders of nouns, important and useful phrases, conjugating verbs and adjectives, regular and irregular words, and more, in Spanish!
Click here to get started!
Visit the Official Alfabetons Website: https://alfabetons.com
Vanilla2011
Scratcher
500+ posts

letter # of () in ()

Seth_Zaw wrote:

Duplicate
They didn't duplicate ur post. U duplicated their post. This thread's URL number is smaller, therefore, u should redirect ur thread to this thread and close it.

Last edited by Vanilla2011 (Sept. 5, 2020 03:29:47)


Za-Chary wrote:

aw heck naw someones' wanting to ban the sab spunch bop faec from scrathc



(ツ::#000)//Master Kakawam, slays evil kumquats.
Vanilla2011
Scratcher
500+ posts

letter # of () in ()

SpacePirate80 wrote:

This is pretty cool. It would be helpful but it's fairly easy to work around.

define Find letter # of (char) in (string)
set [ i] to [1]
repeat (length of (string))
if <(letter (i) of (string)) = (char)> then
set [location of char in string] to (i)
stop [ this script]
end
change [i] by (1)
end

I tested it and it works perfectly everytime. It only works if you only put in one character. (I couldn't get
(char)
and
(string)
to become purple so just pretend they are)
Although, it would be pretty nice just to have a block to do that for us.
How to make the vars purple:
define Find letter # of (char) in (string)
set [ i] to [1]//Don't put a pause in the blocks here.
repeat (length of (string))
if <(letter (i) of (string)) = (char)> then
set [location of char in string v] to (i)
stop [this script v]
end
change [i] by (1)
end

Za-Chary wrote:

aw heck naw someones' wanting to ban the sab spunch bop faec from scrathc



(ツ::#000)//Master Kakawam, slays evil kumquats.
Knightbot63
Scratcher
1000+ posts

letter # of () in ()

removed the python code
Bump, or Bring Up This Post!

Working on an RPG. Consistently losing followers because of inactivity.
I head to forums time-to-time. Not as much as I used to.
_Icicle-Cube_
Scratcher
500+ posts

letter # of () in ()

erm guys, don't you think we're necroposting?
we're bumping a topic from *2019 that isn't that relevant
edit, I meant 2019, not 2020.

Last edited by _Icicle-Cube_ (Dec. 1, 2022 00:11:50)


Moved to MultigenderMess-_ and MulitigenderMess-, I sometimes use this account though


_Icicle-Cube_

Alt: @_lcicle-Cube_ (_Lcicle-Cube_)
+ + more
I have other alts, but if you see someone pretending to be me or my main, let me know on my profile :)

control sift down to funny
shey/they/it/ice/fae or anything that isn't he/him or related to he/him (h*/h*m is my only exception to this rule.)
she/her are my auxiliary pronouns
If I don't understand you are joking/being sarcastic. Do not act like I should always understand that. Not everyone can detect tone in text like you can
I also have a collection of pride flags on my pc
An0therRand0mC0der
Scratcher
1000+ posts

letter # of () in ()

_Icicle-Cube_ wrote:

erm guys, don't you think we're necroposting?
we're bumping a topic from *2019 that isn't that relevant
edit, I meant 2019, not 2020.
How is this not relevant? The suggestion isn't resolved.
_Icicle-Cube_
Scratcher
500+ posts

letter # of () in ()

An0therRand0mC0der wrote:

_Icicle-Cube_ wrote:

erm guys, don't you think we're necroposting?
we're bumping a topic from *2019 that isn't that relevant
edit, I meant 2019, not 2020.
How is this not relevant? The suggestion isn't resolved.
my bad, still it feels kinda wrong to talk in a topic made 3 - 4 years ago

Moved to MultigenderMess-_ and MulitigenderMess-, I sometimes use this account though


_Icicle-Cube_

Alt: @_lcicle-Cube_ (_Lcicle-Cube_)
+ + more
I have other alts, but if you see someone pretending to be me or my main, let me know on my profile :)

control sift down to funny
shey/they/it/ice/fae or anything that isn't he/him or related to he/him (h*/h*m is my only exception to this rule.)
she/her are my auxiliary pronouns
If I don't understand you are joking/being sarcastic. Do not act like I should always understand that. Not everyone can detect tone in text like you can
I also have a collection of pride flags on my pc
Eletiva_ilp_29
Scratcher
50 posts

letter # of () in ()

support ! :: reporter sensing

when i receive [hungry v]
repeat until <<don't be hungry :: sensing> or <[hungry] = [false]>>
take the [bread v], [mortadella v] and [mozzarella v] :: motion
make a sandwich :: events
eat the sandwich :: variables
end
wait until <wait until you're hungry :: sensing>
broadcast [hungry v]

Powered by DjangoBB