I have a line, the line contains, for example, "Hello \ nThis is a test. \ N".
I want to split the whole line on every \ n in the line. I already made this code:
vector<string> inData = "Hello\nThis is a test.\n"; for ( int i = 0; i < (int)inData.length(); i++ ) { if(inData.at(i) == "\n") { } }
But when I agree with this, I get the error message: (\ n as a string)
binary '==' : no operator found which takes a left-hand operand of type 'char' (or there is no acceptable conversion)
(above code)
'==' : no conversion from 'const char *' to 'int' '==' : 'int' differs in levels of indirection from 'const char [2]'
The problem is that I canโt see if char matches the "new line". How can i do this?
source share