Given a string
String item = 'Hello\nWorld'
I want a function that removes \n
from the given string
Something like this
String newItem = removeBacklash(item);
print(newItem); // newItem will be 'HelloWorld'
CodePudding user response:
You can use .replaceAll()
String removeBacklash(String data) => data.replaceAll("\n", "");
More about String