#include <iostream> #include <string> using namespace std; int main() { string a; string str="a:=3;b:=4;c:=5;"; int index=str.find(";"); a=str.substr(0,index); a=a.substr(a.find("=")+1,a.size()); cout<<a<<endl; str=str.replace(0,index+1,""); a=str.substr(0,index); a=a.substr(a.find("=")+1,a.size()); cout<<a<<endl; str=str.replace(0,index+1,""); a=str.substr(0,index); a=a.substr(a.find("=")+1,a.size()); cout<<a<<endl; str=str.replace(0,index+1,""); return 0; }
标签:index,分割,string,int,substr,str,字符串,include From: https://www.cnblogs.com/As198601/p/16839658.html