文字列置換

移転しました。

Objective-Cの文字列置換。WEB上にそれほど多く情報がのっていなかったのでメモ。
replaceOccurrencesOfStringを使えば置換できる。
以下ではhogefugaという文字をhogehogeに変更する。

NSMutableString *tstr = [NSMutableString stringWithString:@"hogefuga"];
int ret = [tstr replaceOccurrencesOfString: @"fuga" 
     withString: @"hoge"
     options:0
     range:NSMakeRange( 0 , [tstr length] )
];