Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

How to search if a string contains an array value

$
0
0

Hey folks,

 

I'm a bit stuck on the following: I've got a string of text and an array that I want to compare (I want to check if any of the values in the array exist in the string), but I can't get it to work. I also want this to work in a While loop.

 

 

I've been thinking of a way to give an example of what I'm trying to do, but I don't know how I'd approach this using AutoIt. Let's say for arguments sake that I have a $string = "1,2,3,4,5,6,7,8,9" and Global $array[3] = ["1", "3", "6", "9"]

 

My question is then : how do I search if any of the values in the array (so 1,3,6,or 9) exist in the string? I don't necessarily need a return of which of these values exists in the string, so long as any of them does. In a sense you could say I'm trying to do the exact opposit of what an arraysearch does.

 

Thanks a lot in advance for the help.

 


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>