Need help how do I check if label contain word in list?

hi i need help, how can i check if a label contain word in list?
what block i need to use?

Hi there,

Try using this block.

image

This tests if piece is in text.

Edit: If you want a word in a list, try these:

image

2 Likes


hi there, thank you for helping me :slight_smile:
I already try your block but it always return true on last list (sphagetti)
when i try to change label 1 to pizza it return false
i try to change other, the return is false.
why is this happened?

Perhaps try this way

image

2 Likes

Sorry, it's my fault. I realized what's the problem now.

image

Do these work?

1 Like

This might work, but if the labe's text is hello world and there is only hello in the list, it returns false.

1 Like

@Redynan_frozt If the label's text is France and the list's version is france, do you want it to return true?

1 Like

In which case

image

3 Likes

hi @TIMAI2 thank you for your help :slight_smile:
i already try your block but it doesn't work. coz the text in label 1 is "i want pizza". and i need to recognized if in the list there is food that in label 1 :slight_smile:

thankyou so much @Gordon_Lu I already try yur block and it works like charm :slight_smile:
thankyou so much your guidance :slight_smile:

1 Like

but how i can check from label 1 "i want pizza" if in the list and extract the word "pizza" from label 1?

I already try this block but the result in label 2 is [false, false, false, true]
block2

Because you did not use the is in list? block? Check the screenshot again in post #4.

image

1 Like

This could other way to examine the presence of word(s) from a list in a sentence

1 Like

With one correction, since earlier code block wasn't producing result with confidence.

blocks (22)

4 Likes

Here is a tutorial (https://imagnity.com/tutorials/app-inventor/list-blocks-on-app-inventor/) by Sajal. Look for 6. Search for an Item. The tutorial explains why the method 'works' and you may find the explanation useful.

2 Likes

hi all thank you for your help. I already solve the block because all of you.
the greatest thankyou to all of you :slight_smile:
especially @Gordon_Lu and @TIMAI2 and @RamNaresh :slight_smile:
cheers :+1:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.