|
@@ -270,8 +270,12 @@ class StringAutoTest : AutoTest {
|
|
return autoreleasepool {
|
|
return autoreleasepool {
|
|
var checkString = check
|
|
var checkString = check
|
|
var resultStr = result
|
|
var resultStr = result
|
|
- let maxSize = checkString.length
|
|
|
|
|
|
+ var maxSize = checkString.length
|
|
var successCount = 0;
|
|
var successCount = 0;
|
|
|
|
+
|
|
|
|
+ resultStr = resultStr.replacingOccurrences(of: "\n", with: "") as NSString
|
|
|
|
+ resultStr = resultStr.replacingOccurrences(of: " ", with: "") as NSString
|
|
|
|
+
|
|
/**
|
|
/**
|
|
(A0 = B0)
|
|
(A0 = B0)
|
|
- A-1 & B-1
|
|
- A-1 & B-1
|
|
@@ -307,7 +311,11 @@ class StringAutoTest : AutoTest {
|
|
resultStr = resultStr.substring(from:1) as NSString
|
|
resultStr = resultStr.substring(from:1) as NSString
|
|
successCount = successCount + 1
|
|
successCount = successCount + 1
|
|
callback(NSAttributedString(string: subc as String))
|
|
callback(NSAttributedString(string: subc as String))
|
|
- } else if (cRange.location != NSNotFound &&
|
|
|
|
|
|
+ }else if (["\n", "\r", " "].contains(subc)) {
|
|
|
|
+ callback(NSAttributedString(string: subc as String))
|
|
|
|
+ maxSize -= 1;
|
|
|
|
+ checkString = checkString.substring(from:1) as NSString
|
|
|
|
+ }else if (cRange.location != NSNotFound &&
|
|
rRange.location != NSNotFound) {
|
|
rRange.location != NSNotFound) {
|
|
if (min(cRange.location, rRange.location) >= 2) {
|
|
if (min(cRange.location, rRange.location) >= 2) {
|
|
let nextc = checkString.substring(with: NSRange(location: 1, length: 1)) as NSString
|
|
let nextc = checkString.substring(with: NSRange(location: 1, length: 1)) as NSString
|
|
@@ -317,11 +325,11 @@ class StringAutoTest : AutoTest {
|
|
|
|
|
|
if (min(nrRange.location, ncRange.location) < min(cRange.location, rRange.location)) {
|
|
if (min(nrRange.location, ncRange.location) < min(cRange.location, rRange.location)) {
|
|
if (ncRange.location < nrRange.location) {
|
|
if (ncRange.location < nrRange.location) {
|
|
- //‘subc' 字符串有在‘resultStr’中,但'subr'不在’checkString‘中,resultStr 往后推一
|
|
|
|
|
|
+ //‘subc' 字符串有在‘resultStr’中,但'subr'不在’checkString‘中,resultStr 往后推一位
|
|
skipString = skipString.appending(subc as String) as NSString
|
|
skipString = skipString.appending(subc as String) as NSString
|
|
checkString = checkString.substring(from:1) as NSString
|
|
checkString = checkString.substring(from:1) as NSString
|
|
}else {
|
|
}else {
|
|
- //‘subc' 字符串有在‘resultStr’中,但'subr'不在’checkString‘中,resultStr 往后推一
|
|
|
|
|
|
+ //‘subc' 字符串有在‘resultStr’中,但'subr'不在’checkString‘中,resultStr 往后推一位
|
|
failString = failString.appending(subr as String) as NSString
|
|
failString = failString.appending(subr as String) as NSString
|
|
resultStr = resultStr.substring(from:1) as NSString
|
|
resultStr = resultStr.substring(from:1) as NSString
|
|
}
|
|
}
|
|
@@ -423,8 +431,8 @@ class StringAutoTest : AutoTest {
|
|
var documentAttributes:NSDictionary!
|
|
var documentAttributes:NSDictionary!
|
|
let checkAttString = NSAttributedString.init(rtf: checkData, documentAttributes: &documentAttributes)
|
|
let checkAttString = NSAttributedString.init(rtf: checkData, documentAttributes: &documentAttributes)
|
|
var checkString = NSString(string: checkAttString!.string) as NSString
|
|
var checkString = NSString(string: checkAttString!.string) as NSString
|
|
- checkString = checkString.replacingOccurrences(of: "\n", with: "") as NSString
|
|
|
|
- checkString = checkString.replacingOccurrences(of: " ", with: "") as NSString
|
|
|
|
|
|
+// checkString = checkString.replacingOccurrences(of: "\n", with: "") as NSString
|
|
|
|
+// checkString = checkString.replacingOccurrences(of: " ", with: "") as NSString
|
|
// 常规 rtf 读取失败
|
|
// 常规 rtf 读取失败
|
|
|
|
|
|
//使用框排进行读取
|
|
//使用框排进行读取
|