Java では、次のようにします。
String temp = ".";
System.out.println(temp);
Objective-Cでそれを行うにはどうすればよいですか?
Java では、次のようにします。
String temp = ".";
System.out.println(temp);
Objective-Cでそれを行うにはどうすればよいですか?
NSString *temp = @".";
NSLog(@"%@", temp);
NSLog フォーマット指定子:
%@ Object, calls the Object's description method
%d, %i signed int
%u unsigned int
%f float/double
%p for pointers to show the memory address
%zu value of type size_t (for sizeof(variable function)
%s C strings
\u can used for arbitrary unicode chars example:NSLog(@"\u03c0");//π
Objective-C には、実際には専用の印刷機能がありません。NSLog は、与えられた内容と一連のデバッグ情報を出力します。まっすぐに印刷する場合は、基本的に Cprintf()
が依然として標準です。あなたのコードに相当するものとして、私は書きます:
NSString *temp = @".";
printf("%s\n", [temp UTF8String]);