UPE // Do not hurt the latest override information.

This commit is contained in:
ShikiSuen 2022-02-24 22:27:48 +08:00
parent 078b30c29d
commit 448b0bf959
1 changed files with 4 additions and 3 deletions

View File

@ -491,15 +491,16 @@ extension String {
// Step 4: Deduplication.
arrData = strProcessed.components(separatedBy: "\n")
strProcessed = "" // Reset its value
let arrDataDeduplicated = Array(NSOrderedSet(array: arrData).array as! [String])
for lineData in arrDataDeduplicated {
// reversed override
let arrDataDeduplicated = Array(NSOrderedSet(array: arrData.reversed()).array as! [String])
for lineData in arrDataDeduplicated.reversed() {
strProcessed += lineData
strProcessed += "\n"
}
// Step 5: Remove duplicated newlines at the end of the file.
strProcessed.regReplace(pattern: "\\n\\n", replaceWith: "\n")
// Step 6: Commit Formatted Contents.
self = strProcessed
}