Can you search text in an expression?


Author
Message
writekristin
writekristin
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 17, Visits: 62
I would like to increase a counter value based on whether the stimulus name contains certain letters.  I know I can get the stimulus name using picture.picturename.currentitem, but is there a way to then search whether this name contains a certain letter or phrase?
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Yes, you can use the string functions detailed in the functions reference in the documentation's language reference section.

searchSearches the first string for any occurence of the second string. If the string is found, it returns the zero based index of the first occurence. If the string is not found, it returns -1.search("benjamin", "ben")
search("benjamin", "benji")
search("benjamin", "jamin")
0
-1
3

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search