nassss

Untitled

Jan 11th, 2020
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public static int IndexOf(string str, char value)
  2. {
  3. if (str == null || value == '\u0000')
  4. {
  5. throw new ArgumentNullException();
  6. }
  7. else
  8. {
  9. int position = 0;
  10.  
  11. for (int i = 0; i < str.Length; i++)
  12. {
  13. if (value == str[i])
  14. {
  15. position = i;
  16. return position;
  17. }
  18. }
  19. return -1;
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment