Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9218893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:58:19+00:00 2026-06-18T02:58:19+00:00

I have a string of IDs in CSV format in an input box 12,23,26,32

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:58:20+00:00Added an answer on June 18, 2026 at 2:58 am

    Use indexOf. You can check if it contains a subString. If not found, it returns -1

    var str = "12,23,26,32"
    return !(str.indexOf("23")!=-1 || str.indexOf("24")!=-1) // Dont have 23 or 24
    

    =======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.

    var array = "12,23,26,32".split(",");
    return !(array.indexOf("23")!=-1 || array.indexOf("24")!=-1) // Dont have 23 or 24
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 100000 Ids to store into our DataBase. Id is in string format.each
I have string like this : <input name=my_name id=my_id value=my_value class=my_class /> I would
I have a sting similar to this $_POST[ids]='ABC,DEF,GHI' I want to seperate each of
I have string that look like Array that fetched from other webservice like this
I have string as abvd.qweqw.sdfs.a=aqwrwewrwerrew . I need to parse this string and get
I have string. I then split the string to make an array. I use
I have a varchar field that contains a string like 10,11,12,13. How can I
I have a CSV string: string data = G9999999990001800002777107050,G9999999990002777107HMNLAQKPRLLHRAQRWJ010,1,3,29,P,6.74,11.23,07,P,5.25,14.29,08,P,6.89,16.92,2,5,052,U,4.78,31.04,095,O,9.59,27.63,076,P,3.85,16.50,094,P,4.84,18.30,093,O,8.28,26.90,062,P,4.64,16.00,061,P,2.84,12.87,090,O,7.90,20.83,050,P,3.36,16.59,057,B,12.05,34.46,1,1,111,P,7.26,13.79; The first 2 elements are
I have a table A with this column: IDS(VARCHAR) 1|56|23 I need to run
I would like to use regular expression to check if my string have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.