Why doesn’t this method exist? If i have a long string that has a lot of \r\n’s in it and I want to parse it line by line, i have to do the following:

std::string src = myString.toStdString();
std::istringstream f( src );
std::string l;
while( std::getline(f, l) {
    String line(l);
    //now do whatever I need to do with this individual line
    if( line.indexOf(....

I haven’t tested, but you can probably use some string array methods :

StringArray sa;
sa.addTokens (yourString, "\n\r", "\"");

for (const String& line : sa)

edit : actually you can use StringArray::addLines() :slight_smile:

1 Like
auto lines = StringArray::fromLines (yourString);


for (auto& line : StringArray::fromLines (yourString))