C文字列の先頭から指定した文字数分までのNSStringを作って返します
+(id)stringWithCString:(const char *)cString length:(unsigned)length
解説
■10.4以降非推奨。
(stringWithCString:encoding: を使います。)
C文字列(cString)の先頭から指定した文字数(length)分までのNSStringを作って返します。
返り値
( id )
文字列(NSStringまたはそのサブクラス)
引数
( const char * )cString
C文字列
( unsigned )length
文字長
フレームワーク
Foundation
クラス
NSString
Class Methods
使用可能
10.0
参照
例文
//sample1 AEKeyword aKeyword; [ NSString stringWithCString:(char*)&aKeyword length:4 ] //sample2 #import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSLog([NSString stringWithCString:"abcdefghijklmn" length:4 ]); } @end