Instance Method インスタンスメソッド

stringByAppendingPathExtension:

Returns a new string made by appending to the receiver an extension separator followed by a given extension. ある新しい文字列を返します、レシーバに拡張子の分離子に続けて与えられた拡張子を追加することによって作られます。

Declaration 宣言

- (NSString *)stringByAppendingPathExtension:(NSString *)str;

Parameters パラメータ

ext

The extension to append to the receiver. レシーバに追加する拡張子。

Return Value 戻り値

A new string made by appending to the receiver an extension separator followed by ext. レシーバに拡張子分離子に続けてextを追加することによって作られる新しい文字列。

Discussion 議論

The following table illustrates the effect of this method on a variety of different paths, assuming that ext is supplied as @"tiff": 以下の表は、このメソッドの効果を様々な異なるパスに関して解説します、ext@"tiff"として提供されると仮定します:

Receiver’s String Value レシーバのもつ文字列値

Resulting String 結果文字列

/tmp/scratch.old

/tmp/scratch.old.tiff

/tmp/scratch.

/tmp/scratch..tiff

/tmp/

/tmp.tiff

scratch

scratch.tiff

Note that adding an extension to @"/tmp/" causes the result to be @"/tmp.tiff" instead of @"/tmp/.tiff". This difference is because a file named @".tiff" is not considered to have an extension, so the string is appended to the last nonempty path component. 拡張子を@"/tmp/"に加えることは結果が@"/tmp.tiff"になることを引き起こします、@"/tmp/.tiff"ではなく。この違いは、@".tiff"という名前のファイルは拡張子を持つとは考えられないためです、それでその文字列は最後の空でないパス構成要素に加えられます。

Note that this method only works with file paths (not, for example, string representations of URLs). このメソッドはファイルパスでのみ働くことに注意してください(例えば、URLの文字列表現ではなく)。

Special Considerations 特別な注意事項

Prior to OS X v10.9 this method did not allow you to append file extensions to filenames starting with the tilde character (~). OS X 10.9より前にこのメソッドはあなたがファイル拡張子をチルダ(~)で始まるファイル名に追加することを許可しませんでした。

See Also 参照

Working with Paths パスを扱う