I have strings like this:
/Administration/References
/Administration/Menus/Home
etc
Is there an easy way that I can find the 1st, 2nd and 3rd words that appear in these strings and place it into an array. ie. the text between the slashes?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
The easiest way in this case is
This will give you an array of all the words seperated by the slashes.
The
StringSplitOptions.RemoveEmptyEntrieswill make sure that you don’t get empty entries, since the string is starting with a / it will give an empty first element in the array. If you have a trailing / it will give a empty last element as well.