ソースの表示以前のリビジョンバックリンク全て展開する/折り畳む文書の先頭へ Share via Share via... Twitter LinkedIn Facebook Pinterest Telegram WhatsApp Yammer Reddit Teams最近の変更Send via e-Mail印刷パーマリンク × 文書の過去の版を表示しています。 NSStringで使える書式指定子 Mac OS X v10.6の「String Format Specifiers」より抜粋。 指定子 解説 %@Objective-Cオブジェクト。利用可能なら<ilcode>descriptionWithLocale:</ilcode>ないし<ilcode>description</ilcode>が返す文字列を表示する。同様に<ilcode>CFTypeRef</ilcode>オブジェクトも対象で、<ilcode>CFCopyDescription</ilcode>の結果を返す。 %%'%'文字 %d, %D, %i符号あり32ビット整数(int) %u, %U符号なし32ビット整数(unsigned int) %hi符号あり16ビット整数(short) %hu符号なし16ビット整数(unsigned short) %qi符号あり64ビット整数(long long) %qu符号なし64ビット整数(unsigned long long) %x符号なし32ビット整数(unsigned int)を16進表記。小文字のa〜fを用いる。 %X符号なし32ビット整数(unsigned int)を16進表記。大文字のA〜Fを用いる。 %qx符号なし64ビット整数(unsigned int)を16進表記。小文字のa〜fを用いる。 %qX符号なし64ビット整数(unsigned int)を16進表記。大文字のA〜Fを用いる。 %o, %O符号なし32ビット整数(unsigned int)を8進表記。 %f64ビット浮動小数点値(double) %e64ビット浮動小数点値(double)を指数表記。指数文字は小文字のeを用いる。 %E64ビット浮動小数点値(double)を指数表記。指数文字は大文字のEを用いる。 %g64-bit floating-point number (double), printed in the style of %e if the exponent is less than –4 or greater than or equal to the precision, in the style of %f otherwise %G64-bit floating-point number (double), printed in the style of %E if the exponent is less than –4 or greater than or equal to the precision, in the style of %f otherwise %c8ビット符号なし文字(unsigned char)。<ilcode>NSLog()</ilcode>ではASCIIキャラクターを表示し、非ASCIIキャラクターの場合は\\dddの8進表記で、Unicodeは\\uddddの16進表記で表示する(ここでdは桁を表す)。 %C16ビットUnicode文字(unichar)。<ilcode>NSLog()</ilcode>ではASCIIキャラクターを表示し、非ASCIIキャラクターの場合は\\dddの8進表記で、Unicodeは\\uddddの16進表記で表示する(ここでdは桁を表す)。 %sNULL終端の8ビット符号なし文字配列。%s interprets its input in the system encoding rather than, for example, UTF-8. %SNULL終端の16ビットUnicode文字配列。 %pvoidポインタ(void *)。0xに続く16進表記。小文字のa〜fを用いる。 %L長さ修飾子。a, A, e, E, f, F, g, Gを修飾すると、long doubleの引数を受ける指定子へ変化する。 %a64-bit floating-point number (double), printed in scientific notation with a leading 0x and one hexadecimal digit before the decimal point using a lowercase p to introduce the exponent %A64-bit floating-point number (double), printed in scientific notation with a leading 0X and one hexadecimal digit before the decimal point using a uppercase P to introduce the exponent %F64-bit floating-point number (double), printed in decimal notation %zLength modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument %tLength modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument %jLength modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a intmax_t or uintmax_t argument programming/mac/nsstring_format_specifiers.1383232610.txt.gz 最終更新: 2013-11-01 00:16by Decomo