playMaker

Author Topic: String Contains didn't works  (Read 1852 times)

blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
String Contains didn't works
« on: January 20, 2023, 08:21:13 AM »
Hello,

I'm making a search filter to let the user check for a string.

But it seems I am missing something ?

In my example, Leaf can't be fund inside Baby Leaf ?


blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
Re: String Contains didn't works
« Reply #1 on: January 20, 2023, 08:25:59 AM »
I also tried to inverse variables order as
Is Baby Leaf is Containing Leaf
or Flammeche is containing Flammeche

The result is False each time

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: String Contains didn't works
« Reply #2 on: January 20, 2023, 09:10:25 AM »
Hi.
I think you need to swap the 2 variables :)
As you are checking if the "Leaf" contains "Baby Leaf" :)

blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
Re: String Contains didn't works
« Reply #3 on: January 20, 2023, 01:12:59 PM »
I also tried to inverse variables order as
Is Baby Leaf is Containing Leaf
or Flammeche is containing Flammeche

The result is False each time


As i said it's what I did here... no difference, this is really strange.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: String Contains didn't works
« Reply #4 on: January 21, 2023, 12:45:01 AM »
Hi.
I did a quick test and it seems to work fine for me.



Try to set "Leaf" directly on the "Contains String'
or try on a new scene and set the values by hand and see if it work then.

how are you getting the search string?

It is possible it has a 'hidden' return (next line) which would give a false event

blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
Re: String Contains didn't works
« Reply #5 on: January 21, 2023, 07:14:59 AM »
the search comes from an input text,
yes i used enter at the end to finish tipping the word
I'll check again

blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
Re: String Contains didn't works
« Reply #6 on: January 21, 2023, 07:43:13 AM »
This time I didn't use enter, simply clicked on the search button, so no hidden return possible.

blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
Re: String Contains didn't works
« Reply #7 on: January 21, 2023, 07:47:25 AM »
If I enter the names manually it works

blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
Re: String Contains didn't works
« Reply #8 on: January 21, 2023, 08:00:09 AM »
I think my problem comes from the Get property Text
Because if i use it it doesn't work if i enter the variable manually it works

blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
Re: String Contains didn't works
« Reply #9 on: January 21, 2023, 08:05:36 AM »
Got it to work !

The get property was not set to the right Text Component.
I was using the last one in the hierarchy, I don't know exactly why and what is the difference... but it works like that !
thanks for your help
« Last Edit: January 30, 2023, 01:19:29 PM by blackant »