NSString은 '변형'이 안됨  -> 보안

NSMutableString*string; 

string= [NSMutableStringstringWithCapacity: 50];
[string appendString: @"Hello there"]; 
[string appendFormat: @"human %d!", 39]; 
//string은@”Hellotherehuman39”을가짐 ... 

-(void) deleteCharactersInRange: (NSRange) range; 
NSMutableString *friends; 
friends= [NSMutableString stringWithCapacity: 50]; 
[friendsappendString: @"James BethLynn Jack Evan"];

NSRange jackRange; 
jackRange = [friends rangeOfString: @”Jack”]; 
jackRange.length++; // 공백문자포함시킬려고1 증가 

[friends deleteCharactersInRange: jackRange]; 
//결과문자열은“James BethLynn Evan” 

'STUDY > Objective-C' 카테고리의 다른 글

[Objective C] method 앞에 plus (+) , minus (-)  (0) 2010.06.24
[Objective C] NSArray , NSMutableArray, Enumeration  (0) 2010.06.24
[Objective C] NSMutableString  (0) 2010.06.24
[Objective C] NSString  (0) 2010.06.24
[MAC] Xcode 자동정렬 Tip  (1) 2010.06.24
[Objective C] Composition  (0) 2010.06.24

Comment



티스토리 툴바