how to check if a character exists in a string c#
  • i want to know how can i check if specific character find in string or not i.e i have string "abcd" so i want to check if "a" exist or not in string?
  • 1 Comment sorted by
  • Vote Up0Vote Down ithackerithacker
    117.50 Karma Accepted Answer
    use IndexOf function
    if its return 0 or greater than 0 number its mean character exist in string .
    and if its return -1 its mean character not found in string.


    string str = "Hello World";
    int Index = str.IndexOf("e");


Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

    Optimum Creative