A feature I’d like to see in Hopscotch is: occurrences, in the same category as character at index and length and stuff
Explanation thingies
nth, first and last occurrences
First occurrence outputs where in a string (by characters) (a) character(s) first appears
Last occurrence output where it last appears
Nth occurrence is like [(5)th occurrence of (aw) in (awawawawawaw)], and n is some number that you choose
If n = 5, it shows the position of the 5th occurrence of aw in awawawawaw, that I think is 8…
Number of occurrences
It outputs the number of time a number/string occurs in a number/string
So in
[Set (sigh) to (number of occurrences of (ll) in (llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch))
Sigh = 5
I’d use it for this type of project: shrug dunno
Here are some examples of Hopscotch code that could be improved if we had this: I dont know :(
Here is an example design I’ve made:
((10)th occurrence of (hi) in (hihihi))
(First occurrence of (hi) in (hihihi))
(Last occurrence of (hi) in (hi oof hi hi)
(Occurrences of (e) in (electogenius))
I’ve seen something similar in another programming languages, it looks like this:
I know it is in JavaScript, not sure about the others