Sha256: 9f8a1dbc62737fb467d28a25ce9f6dbf064776b967f3ed91d9659c1bb3f4c9c1
Contents?: true
Size: 855 Bytes
Versions: 62
Compression:
Stored size: 855 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 CFURLCreateStringByReplacingPercentEscapes( nil, self, "" ) 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
62 entries across 62 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-1.5.2 | lib/sugarcube-foundation/nsstring.rb |
sugarcube-1.5.1 | lib/sugarcube-foundation/nsstring.rb |