Couldn't you do something like this???
Convert the Word your searching for to an Object using the CType function Loop through the Array and use the Object,Equals method on the Array Index Value It should return a Boolean value of whether or not your Objects are Equal. -----Original Message----- From: Helge Thomas Hellerud [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 26, 2005 10:40 AM To: [email protected] Subject: RE: [AspNetAnyQuestionIsOk] Check if a word exists in an string array Thanks, but then I have to take the word out of the array, before comparing. When there are many words in the array, I believe there must be an advantage to search for the word directly in the array? Helge ________________________________________ From: Eric Cantrall [mailto:[EMAIL PROTECTED] Sent: 26. januar 2005 16:35 To: '[email protected]' Subject: RE: [AspNetAnyQuestionIsOk] Check if a word exists in an string array Look at these methods: I believe you might want String.Equals String.Compare String.CompareTo String.Equals Instead of IndexOf HTH --Eric -----Original Message----- From: Helge Thomas Hellerud [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 26, 2005 10:23 AM To: AspNetAnyQuestionIsOk Subject: [AspNetAnyQuestionIsOk] Check if a word exists in an string array Hello, I have a string array with words. How can I check if a specific word exists in the array? The problem with myArray.IndexOf(myArray, word) is that it returns > 0 if the parameter word is a part of an element in the array (i.e. the word "in" matches "invite"). I want to check if only the WHOLE word exists, not a part of it. Helge _____ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/> <http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/> > * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED] e> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of <http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> > Service. [Non-text portions of this message have been removed] ________________________________________ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/> * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. _____ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/> * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED] e> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of <http://docs.yahoo.com/info/terms/> Service. [Non-text portions of this message have been removed] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
