Type Method 型メソッド

stringEncoding(for:encodingOptions:convertedString:usedLossyConversion:)

Returns the string encoding for the given data as detected by attempting to create a string according to the specified encoding options. 与えられたデータに対する文字列符号化を返します、指定された符号化オプションによって文字列を作成することを試みることによって検出されるとおりに。

Declaration 宣言

class func stringEncoding(for data: Data, 
          encodingOptions opts: [StringEncodingDetectionOptionsKey : Any]? = nil, 
          convertedString string: AutoreleasingUnsafeMutablePointer<NSString?>?, 
      usedLossyConversion: UnsafeMutablePointer<ObjCBool>?) -> UInt

Parameters パラメータ

data

An NSData object containing bytes in an encoding to be determined. 判定されることになる、ある符号化でのバイトを含んでいるNSDataオブジェクト。

opts

Options to use when attempting to determine the string encoding. See String Encoding Detection Options for a full list of supported options. 文字列符号化を判定しようと試みる時に使うオプション。String Encoding Detection Optionsをサポートされる完全な一覧として見てください。

string

If a string encoding could be determined, upon return contains an NSString object constructed from data using the determined string encoding. 文字列符号化が決定されることができたならば、戻りでは決定された文字列符号化を使ってデータから組み立てられるNSStringオブジェクトを含みます。

usedLossyConversion

If a string encoding could be determined, upon return contains a BOOL value corresponding to whether lossy conversion was used. 文字列符号化が決定されることができたならば、戻りでは非可逆変換が使われたかどうかに対応しているBOOL値を含みます。

Return Value 戻り値

An NSStringEncoding value, or 0 if a string encoding could not be determined. あるNSStringEncoding値、または文字列符号化が決定されることができなかったならば0

See Also 参照

Working with Encodings エンコーディングを扱う