Sha256: 0e25375ab3272c3d9a2f91d542239ffe3e853b618b7cb38d1ad24f1a4128c613
Contents?: true
Size: 819 Bytes
Versions: 2
Compression:
Stored size: 819 Bytes
Contents
class NSString # @return [NSURL] def nsurl @url ||= NSURL.alloc.initWithString(self) end # @return [NSURL] def fileurl @fileurl ||= NSURL.fileURLWithPath(self) end def escape_url CFURLCreateStringByAddingPercentEscapes( nil, self, nil, "!*'();:@&=+$,/?%#[]", CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding) ) end def unescape_url self.stringByReplacingPercentEscapesUsingEncoding(NSUTF8StringEncoding) end def remove_accents # removes diacritics by using a lossy conversion ascii = self.dataUsingEncoding(NSASCIIStringEncoding, allowLossyConversion: true) # turn it back into a string return NSString.alloc.initWithData(ascii, encoding: NSASCIIStringEncoding) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-3.4.0 | lib/cocoa/sugarcube-foundation/nsstring.rb |
sugarcube-3.3.7 | lib/cocoa/sugarcube-foundation/nsstring.rb |