Anyone has example to get file extension with Cocoa command pathExtension?
Hagi
Anyone has example to get file extension with Cocoa command pathExtension?
Hagi
set someString to current application's NSString's stringWithString_("Fred.txt")
set theExtension to someString's pathExtension()
Great Shane,
I had missed the stringWithString_
HaGi
It’s just that you need to create an NSString object first, then you can use the NSString instance method pathExtension on it. if you had an NSURL object, you would need to use it’s instance method path which returns an NSString then you could use the pathExtension method. Good luck!
Model: MacBookPro8,2
Browser: Safari 534.51.22
Operating System: Mac OS X (10.7)
That would be unnecessary, though; NSURL also has a -pathExtension method.
Since 10.6 NSURL has a pathExtension method too
Shane’s right, forgot about it…