To check if a string contains a substring in C#, you can use the Contains()
method. Here's an example:
102 chars6 lines
In this example, we're checking if the string str
contains the substring "World". If it does, we'll print "Substring found!" to the console. Otherwise, we'll skip the message.
gistlibby LogSnag