5 Replies - 797 Views - Last Post: 14 April 2011 - 08:05 AM Rate Topic: -----

#1 MohammedA.Gouda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 12-April 11

Check If String Exists In ArrayList

Posted 14 April 2011 - 06:50 AM

how can i check if a string is completely entered into array list or not ?
Is This A Good Question/Topic? 0
  • +

Replies To: Check If String Exists In ArrayList

#2 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1210
  • View blog
  • Posts: 4,124
  • Joined: 27-January 10

Re: Check If String Exists In ArrayList

Posted 14 April 2011 - 07:05 AM

Can you explain what you mean by 'complete'?
Was This Post Helpful? 0
  • +
  • -

#3 Tryparse  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 80
  • View blog
  • Posts: 193
  • Joined: 20-April 10

Re: Check If String Exists In ArrayList

Posted 14 April 2011 - 07:07 AM

If I understand your question, it's just myList.Contains("The string");
Was This Post Helpful? 1
  • +
  • -

#4 MohammedA.Gouda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 12-April 11

Re: Check If String Exists In ArrayList

Posted 14 April 2011 - 07:10 AM

View PostSergio Tapia, on 14 April 2011 - 07:05 AM, said:

Can you explain what you mean by 'complete'?




i mean if a string is entered to text box and i want to deal with and i want to make sure if the arraylist contains all the string
Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq  Icon User is offline

  • Closing in on 5,000
  • member icon

Reputation: 4927
  • View blog
  • Posts: 10,465
  • Joined: 02-June 10

Re: Check If String Exists In ArrayList

Posted 14 April 2011 - 07:49 AM

Loop through the array and check if each element is equal to the string in question.

There is no grey area. You have either added it or you haven't. There is no measure of "completeness"
Was This Post Helpful? 0
  • +
  • -

#6 Curtis Rutland  Icon User is online

  • (╯°□°)╯︵ (~ .o.)~
  • member icon


Reputation: 3795
  • View blog
  • Posts: 6,399
  • Joined: 08-June 10

Re: Check If String Exists In ArrayList

Posted 14 April 2011 - 08:05 AM

Or as Tryparse already mentioned, .Contains works too. Also don't use ArrayLists. Use the generic List<string>.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1