how to check string start in C++

后端 未结 12 2045
Happy的楠姐
Happy的楠姐 2020-11-29 03:31

Is there any way in C++ to check whether a string starts with a certain string (smaller than the original) ? Just like we can do in Java

bigString.startswi         


        
12条回答
  •  无人及你
    2020-11-29 04:16

    Either create a substring that is the length of your smallString variable, and compare the two. Or do a search for the substring smallString and see if it returns index 0

提交回复
热议问题