Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int IndexOf(string str, char value)
- {
- if (str == null || value == '\u0000')
- {
- throw new ArgumentNullException("Input cannot be empty. Please try again!");
- }
- else
- {
- int position = 0;
- for (int i = 0; i < str.Length; i++)
- {
- if (value == str[i])
- {
- position = i;
- return position;
- }
- }
- return -1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment