[] CONTAINS [] Block!

I made a block that is not cap sensitive, plus it uses pure Snap!!

I've never seen "qwertyuiop", "asdfghjkl", or "zxcvbnm" backwards before!

Hmm... "poiuytrewq", "lkjhgfdsa", "mnbvcxz".

Using LENGTH OF (SPLIT FOO BY BAR) to check whether FOO contains BAR is pretty elegant. I think case sensitivity should be settable for primitive text blocks, the way I made it settable in the Strings library. But Jens hates that.

Stop giving me ideas for my Snap! testing! (just kidding :-) )

I never knew how to make it not cap sensitive, until I saw a Replit project that makes the text to all lowercase and then detects if one thing equals another, because in Python, The == operator is case sensitive. So I decided to make a contains block, that doesn't use JavaScript, but is also not case sensitive. So what it does is it first removes letters that it can't put to lowercase. Then it converts everything to lowercase, and then detects if the text contains the second input.

Yes, thats correct.

Are you talking about = or contains because I'm talking about contains.

ah, sorry.

It's OK.

I made some similar to your project but of poor quality., so my is a nothing :~/

Your block doesn't need to contain so much code.
Here's the simplified algorithm. It is way much neater, more clean, and is basically your block but, well, basic.

It's cap sensitive. And the code IS simple, it's just I need to do it to convert both values to lowercase.

And if you want to find a specific letter, that wont work. What does the work here is the SPLIT BY block. So your code won't work.

that's, "sentence contains word" not "string contains string". For example, in your code, "hello world" contains "world", but "apple" would not contain "a" because it's only splitting by word (or whitespace). His code is better because it doesn't check for words, so "apple" contains "a" which is true. Also, most of the code in his block is just converting the text to lowercase.

The Official Right Way to make a case-insensitive version of a string for comparison purposes is toLower(toUpper(toLower(string))). This is so that ß (German esszedt) is converted to SS and then to ss, which it equals. ("Straße" is the same word as "strasse.") A single call to toLower won't change ß because it's already lower case.

PS I don't offhand know of a case in which an upper case diphthong is equivalent to a multi-letter sring, but there must be some. :~)

In that case, you should just make own blocks for toLower and toUpper and use them in the main CONTAINS block.

I'm perfectly happy to let the JavaScript developers deal with that can of worms. In English, case conversion is trivial. But there are a lot of languages, many with gotchas like ß. (And many others without case at all.)

I think you only need pipe (string) through (toUpper(), toLower()), i.e., uppercasing then lowercasing it.

Maybe you're right. I'm not positive.

What I said fixes the esszedt problem, but I'm not sure about others.