How do I remove newlines from a String in Dart?
dart
Solution
You can use replaceAll(pattern, replacement):
main() {
var multiline = "hello\nworld";
var singleline = multiline.replaceAll("\n", " ");
print(singleline);
}
Problem
How do I remove the newlines from a string in Dart? For instance, I want to convert: ``` "hello\nworld" ``` to ``` "hello world" ```