I have a string delimited like so (it's not an array it's a straight string)
string = " [United States] [Canada] [India] ";
I want to do something like below.
if( string contains "Canada" ) { //Do Canada stuff here }
Thanks for any tips
var string = '[United States][Canada][India]'; var search = 'Canada'; if (string.indexOf('[' + search + ']') !== -1) { // Whatever }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With