給定一個字串
String item = 'Hello\nWorld'
\n我想要一個從給定字串中洗掉的函式
像這樣
String newItem = removeBacklash(item);
print(newItem); // newItem will be 'HelloWorld'
uj5u.com熱心網友回復:
您可以使用.replaceAll()
String removeBacklash(String data) => data.replaceAll("\n", "");
更多關于字串
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/533914.html
標籤:细绳扑镖
