I have a string of characters and need to search it to see if I can find a substring in it. The substring has quotes in it. How do I do a substring search with part of the substring having quotes in it.
Example
I have "two dogs" and a "cat".
I want to search to see if the substring "two dogs" is in the sentence (quotes include).
this code doesn't seem to be giving me the correct results. It finds the substring in cases where I have quotes and don't have quotes around the 'two dogs' text. What is the proper way to do this? Thanks.
"""two dogs""" is exactly the same string as """two dogs""" (note the added spaces), which is exactly the same string as "two dogs". C and C++ automatically concatenate string literals when they appear directly adjacent.
The literal you want is "\"two dogs\"".