How to remove lines from a line in Dart?

How to remove lines from a line in Dart?

For example, I want to convert:

"hello\nworld" 

to

 "hello world" 
+4
source share
1 answer

You can use replaceAll (template, replacement):

 main() { var multiline = "hello\nworld"; var singleline = multiline.replaceAll("\n", " "); print(singleline); } 
+6
source

All Articles