Results 1 to 3 of 3
  1. #1
    csanch11 is offline Member
    Join Date
    Oct 2013
    Posts
    63
    Rep Power
    0

    Default Searching through an array question

    An array which contain a list of names. I let for a user input and I use that to search through the array. For example lets say the string name "Christian" is stored inside the names array and the user types in Chri, the program looks in the array and finds a name that contains Chri and prints them out. How do I go about doing this?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,423
    Blog Entries
    7
    Rep Power
    27

    Default Re: Searching through an array question

    For each and every String element in the array check if the user String is part of that particular array element (read the API docs for the String class).

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: Searching through an array question

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Searching in an array
    By gbonecapone in forum New To Java
    Replies: 9
    Last Post: 06-27-2013, 08:07 PM
  2. help with Array searching
    By kamikazii in forum New To Java
    Replies: 2
    Last Post: 01-30-2013, 10:02 AM
  3. Replies: 3
    Last Post: 11-25-2011, 12:38 AM
  4. Searching through Array of Objects
    By coopc in forum New To Java
    Replies: 6
    Last Post: 04-26-2011, 03:32 PM
  5. Replies: 3
    Last Post: 03-15-2011, 12:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •