func filterBlankAndBlankLines(_ str: String?) -> String? {
var Mstr = ""
let arr = str?.components(separatedBy: "\n")
for i in 0..<(arr?.count ?? 0) {
let tempStr = arr?[i]
tempStr?.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) //去除掉首尾的空白字符和换行字符
tempStr?.replacingOccurrences(of: "\r", with: "")
tempStr?.replacingOccurrences(of: "\n", with: "")
if (tempStr?.count ?? 0) != 0 {
Mstr += arr?[i] ?? ""
if i < (arr?.count ?? 0) - 1 {
Mstr += "\n"
}
}
}
return Mstr
}