Shaitan00 Posted December 30, 2003 Posted December 30, 2003 Given an array [public string[] OptArr;] filled with Strings I need a method that would allow me to give the string and have the function return the INDEX in the Array where that string is stored. Any clues? Quote
Administrators PlausiblyDamp Posted December 30, 2003 Administrators Posted December 30, 2003 OptArr.IndexOf() Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Shaitan00 Posted December 30, 2003 Author Posted December 30, 2003 OptArr does not have a .IndexOf property. Currently I am using the usual For/If loops but this reduces performance when my arrays become large. Quote
Administrators PlausiblyDamp Posted December 30, 2003 Administrators Posted December 30, 2003 My bad - VB makes me lazy like that. try the System.Array class' IndexOf method : string[] OptArr = {"one","two","three"}; int i; i= System.Array.IndexOf(OptArr,"two"); Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.