soda
13 years agoContributor
Is there a way to search for an exact match in a string?
Hello,
I've got an array that has some items from a listview stored in it. The entries look similar to this:
Smart Collection 2
Ratings 5
Colors 0
Collection 4
Publish Collection 5
I need to check each entry to verify that the correct number follows the entry. In a data file I've got expected results. Currently I am using indexOf to see if the expected item is in the array. When I am searching for "Collection" it is finding the "Smart Collection" item. Is there a way to perform an exact match when using indexOf? Or, I have seen people suggest using the search method, however, I am not familiar with regular expressions which is what the search method apparently needs? I'll go look through some more examples of regex but have so far not found examples of what I am trying to do. Does TC have anything like this builtin? Thanks for any suggestions.
Mark
I've got an array that has some items from a listview stored in it. The entries look similar to this:
Smart Collection 2
Ratings 5
Colors 0
Collection 4
Publish Collection 5
I need to check each entry to verify that the correct number follows the entry. In a data file I've got expected results. Currently I am using indexOf to see if the expected item is in the array. When I am searching for "Collection" it is finding the "Smart Collection" item. Is there a way to perform an exact match when using indexOf? Or, I have seen people suggest using the search method, however, I am not familiar with regular expressions which is what the search method apparently needs? I'll go look through some more examples of regex but have so far not found examples of what I am trying to do. Does TC have anything like this builtin? Thanks for any suggestions.
Mark