find 与 find.first.of()的区别或功能
两个例子
(1)
int nameLocation = dataString.find( "Name=" ) + 5;
int endName = dataString.find( "age:" );///////////////////////
int ageLocation = dataString.find( "age:" ) + 4;
int endAge = dataString.find( "color:" );
int colorLocation = dataString.find( "color:" ) + 6;
nameString = dataString.substr(
nameLocation, endName - nameLocation);
ageString = dataString.substr(
ageLocation, endAge - ageLocation );
colorString = dataString.substr( colorLocation );
(2)
int nameLocation = dataString.find_first_of( "word=" )+5;
int endLocation = dataString.find_first_of( "&" )-1;///////////////////////////
//retrieve entered word
wordString = dataString.substr(
nameLocation, endLocation - nameLocation );
请问,有谁知道以上两处的写法为什么不同,即(find寻尾不用-1和find_first_of寻尾要-1 这是为什么)