输入:
\ntempTextArray:\n\xe2\x96\xbf 3 个元素
\n- 0 : "\xd7\x96\xd7\x94 \xd7\x9e\xd7\x91\xd7\x97\xd7\x9f"\n- 1 : "7 x 5 abc"\n- 2 : "other text"\nRun Code Online (Sandbox Code Playgroud)\n当做一个简单的tempText = tempTextArray.joined(" | ")结果时,结果并没有将所有元素放置在我期望的位置...结果:
Printing description of tempText:\n"\xd7\x96\xd7\x96\xd7\x94 \xd7\x9e\xd7\x91\xd7\x97\xd7\x9f | 7 x 5 abc | other text"\nRun Code Online (Sandbox Code Playgroud)\n这是我第一次将从右到左与从左到右的文本结合起来,以前有人处理过类似的情况吗?
\n我的应用程序正在从后端接收翻译,因此我不知道哪些元素被翻译成(在本例中)希伯来语,以及我将以默认语言(英语)收到哪些元素
\n当我在"大"(37000行)文本文件上运行以下代码时,是否有人能指出我系统告诉我内存应用程序耗尽的方向?
-(void) writeToFile: (NSString*)filePath withSeparator:(NSString*) fieldSep{
NSString* completeFile = [[[NSString alloc] initWithString:@""] autorelease];
for(int i=0;i<[self numberOfRows];i++){
printf("im at line number... %i of %i\n",i,[self numberOfRows]);
for(int j=0;j<[self numberOfColumns];j++){
completeFile = [completeFile stringByAppendingString:[self objectInRow:i column:j]];
if(j<[self numberOfColumns]-1){
//separator for all columns except last one
completeFile = [completeFile stringByAppendingString:fieldSep];
}
}
completeFile = [completeFile stringByAppendingString:@"\n"];
}
NSError *error = nil;
[completeFile writeToFile:filePath atomically:NO
encoding:NSStringEncodingConversionAllowLossy error:&error];
if(error){
NSLog(@"Error writing file at %@\n%@",
filePath, [error localizedFailureReason]);
}
Run Code Online (Sandbox Code Playgroud)
}
我出于调试原因添加了printf,前面似乎有4000行,然后它慢慢减速...我的文件包含超过37000行,类似于这些:
1893-11-6 136 194 165
Run Code Online (Sandbox Code Playgroud)