How can I check if a string contains a character in C#?

后端 未结 8 993
陌清茗
陌清茗 2020-12-02 09:43

Is there a function I can apply to a string that will return true of false if a string contains a character.

I have strings with one or more character options such

8条回答
  •  感情败类
    2020-12-02 10:24

    Use the function String.Contains();

    an example call,

    abs.Contains("s"); // to look for lower case s
    

    here is more from MSDN.

提交回复
热议问题