Question about strings

One example is when you send an email and the text includes " is attached " but you don't have file attached, the program will detect that and give you a warning. How can you do something similar in c#?