Determine whether a string begins with a given sequence
suggest changestring HelloWorld = "Hello World";
HelloWorld.StartsWith("Hello"); // true
HelloWorld.StartsWith("Foo"); // false
Finding a string within a string
String.Contains reports whether a string contains a substring. It returns true when the substring is present and false otherwise.
string s = "Hello World";
bool stringExists = s.Contains("ello"); //stringExists =true as the string contains the substring
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents