I have a string of IDs in CSV format in an input box
12,23,26,32
I have to check if this string contains 23 or 24, if yes then return false, else return true
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use indexOf. You can check if it contains a subString. If not found, it returns -1
=======EDIT=======
Like @Matt said in comment, this solution will work also to “12,239,26,32” and thats not the point.
Make the split before check the indexOf, then you will get the element between the commas.