废话少说,直接上代码:

#include <iostream>
using namespace std;

int main()
{
	char str[100] = "a^bcddd^xyz^wasldg";
	char *p = strrchr(str, '^');


	if(NULL != p)
	{
		p = p + 1;

		cout << p << endl;
	}
	else
	{
		cout << "no" << endl;
	}

	return 0;
}


    结果为:wasldg


本文转载:CSDN博客