pathExtension
ファイルパスの拡張子を文字列として作って返します
解説
ファイルパスの拡張子を文字列として作って返します。
"."は含まれません。
レシーバーの文字列値 返される文字列
"/tmp/scratch.tiff" ->"tiff"
"/tmp/scratch" ->""(空の文字列)
"/tmp/" ->""(空の文字列)
"/tmp/scratch..tiff" ->"tiff"
返り値
( NSString * )
拡張子
引数
フレームワーク
Foundation
クラス
NSString
Instance Methods
使用可能
10.0
参照
例文
#pragma mark iOS NSString stringByDeletingLastPathComponent -(void)method010 { NSString *str1 = [[NSString alloc] initWithString:@"/tmp/scratch.tiff"]; NSLog(@"%s %p , %@",__FUNCTION__,str1,[str1 pathExtension]); //=>-[OOOAppDelegate method010] 0x5810 , tiff NSString *str2 = [[NSString alloc] initWithString:@"/tmp/scratch"]; NSLog(@"%s %p , %@",__FUNCTION__,str2,[str2 pathExtension]); //=>-[OOOAppDelegate method010] 0x5830 , NSString *str3 = [[NSString alloc] initWithString:@"/tmp/"]; NSLog(@"%s %p , %@",__FUNCTION__,str3,[str3 pathExtension]); //=>-[OOOAppDelegate method010] 0x5840 , NSString *str4 = [[NSString alloc] initWithString:@"/tmp/scratch..tiff"]; NSLog(@"%s %p , %@",__FUNCTION__,str4,[str4 pathExtension]); //=>-[OOOAppDelegate method010] 0x58b0 , tiff }