-1

Does anyone know if this line of code would work for a NSString from an rtf file on iOS?

NSString* cList = [[NSString alloc] initWithContentsOfFile:@"name of file" encoding:NSUTF8StringEncoding error:nil];
c = [cList componentsSeparatedByString:@"\n•    "];

I'm just wondering since it includes a bullet point character which I pretty much copy pasted. I wasn't expecting it to be that easy. It just seems like it should be an escape sequence character or something.

Probably should've included some form of error checking in the first line, but that aside for the moment.

Update: After much compiling with no success with an rtf, I copied the text into a txt and used that instead. Works the first time. Seemed like the rtf reading was getting weird rtf data that wasn't really what I was after when I tried to NSLog it.

Thanks!

4

1 に答える 1

0

Unicodeシーケンスを使用するのはどうですか?お気に入り...

c = [cList componentsSeparatedByString:@"\n\u0000    "];

0000<----ユニコード。

于 2012-05-30T07:09:33.010 に答える