So, as you can see...
#include <iostream>
#include <string>
using namespace std;
int main()
{
char comma = ',';
string str1 = "hello,friend";
string str2 = str1.substr(str1.find(comma)+1, str1.length()); //i guess this line...
cout << str2 << endl;
system("pause");
return 0;
}
What is being output is str2, and it is a substring of str1. It finds the comma, and erases it and any other characters after. This outputs "friend". But what I want is instead of removing the characters after the comma, the characters before comma would be removed. So the data "hello" will be output instead.
Thanks...