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

stringByAddingPercentEncodingWithAllowedCharacters:

Returns a new string made from the receiver by replacing all characters not in the specified set with percent-encoded characters. 指定された集合の中にない全ての文字をパーセントエンコーディングされた文字で置き換えることによってレシーバから作られる新しい文字列を返します。

Declaration 宣言

- (NSString *)stringByAddingPercentEncodingWithAllowedCharacters:(NSCharacterSet *)allowedCharacters;

Parameters パラメータ

allowedCharacters

The characters not replaced in the string. Typically, you specify one of the predefined character sets for a particular URL component, such as URLPathAllowedCharacterSet or URLQueryAllowedCharacterSet. 文字列の中の置き換えられない文字。概して、あなたは特定のURL構成要素に対するあらかじめ定義された文字集合の1つを指定します、例えばURLPathAllowedCharacterSetまたはURLQueryAllowedCharacterSet

Return Value 戻り値

Returns the encoded string, or nil if the transformation is not possible. 符号化された文字列を返します、またはnilをもし変換が可能でないならば。

Discussion 議論

Entire URL strings cannot be percent-encoded, because each URL component specifies a different set of allowed characters. For example, the query component of a URL allows the “@” character, but that character must be percent-encoded in the password component. 全体のURL文字列はパーセント符号化されることはできません、なぜなら各URL構成要素は異なる許可される文字の集合を指定するからです。例えば、あるURLのクエリ構成要素は “@” 文字を許可します、しかしその文字はパスワード構成要素においてはパーセント符号化されなければなりません。

UTF-8 encoding is used to determine the correct percent-encoded characters. Any characters in allowedCharacters outside of the 7-bit ASCII range are ignored. UTF-8符号化は、正しくパーセント符号化された文字を決定するのに使われます。allowedCharactersでの何らかの文字で7-bit ASCIIの範囲外のものは無視されます。

See Also 参照

Working with URL Strings URL文字列を扱う

Related Documentation 関連文書