UPE // Do not hurt the latest override information.

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

View File

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