I want to be able to write a string containing \n to indicate newline breaks, but I want the string to cover multiple lines for example:

string str = "This is just a little string I wrote\n to see if all was upside down or not, or known to be back to front at all.";

if I use:

foreach(c; str){
  if(c == '\n') writeln("new line");
}

I get 2 prints of "new line", one for the \n and one for the new line. Is there any way to isolate the explicit \n?

Reply via email to