![]() ![]() Set aEscapeString to (aString's stringByAddingPercentEncodingWithAllowedCharacters:aCharSet) Set aCharSet to NSMutableCharacterSet's new()ĪCharSet's formUnionWithCharacterSet:(NSCharacterSet's URLQueryAllowedCharacterSet())ĪCharSet's formUnionWithCharacterSet:(NSCharacterSet's URLPathAllowedCharacterSet()) StringByTrimmingCharactersInSet:(NSCharacterSet's whitespaceAndNewlineCharacterSet)) ![]() Set aCleanString to (aNoWhiteSpaceString's ¬ trim any head or tail whiteSpace or newLines StringByReplacingOccurrencesOfString:aPattern withString:" " options:(NSRegularExpressionSearch) range:(current application's NSMakeRange(0, aString's |length|))) Set aPattern to (NSString's stringWithString:"[\\s| Set aString to NSString's stringWithString:aQuery Set aEscaped3 to my escapeSearch:aCleaned3 Set aCleaned3 to my cleanSearchString:aQuer圓 Set aEscaped2 to my escapeSearch:aCleaned2 Set aCleaned2 to my cleanSearchString:aQuery2 Set aQuery2 to " Wreck of the Edmund Fitzgerald Set aEscaped1 to my escapeSearch:aCleaned1 Set aCleaned1 to my cleanSearchString:aQuery1 Set aQuery1 to "Wreck of the Edmund Fitzgerald Property NSRegularExpressionSearch : a reference to 1024 Property NSMutableCharacterSet : a reference to current application's NSMutableCharacterSet Property NSCharacterSet : a reference to current application's NSCharacterSet Property NSString : a reference to current application's NSString ![]() Here’s quickTests I did with AppleScript to solve (I can convert to Objective-C for anyone) use AppleScript version "2.4" - Yosemite (10.10) or later What needs to be tackled is the newLine and extraWhite space needs to be removed first So I just tested NSString's stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSetĪnd while it does find the lineFeed/newLine as illegal. ![]()
0 Comments
Leave a Reply. |