从字符串中删除格式的问题

时间:2012-09-23 16:30:13

标签: objective-c xcode string

我目前正在制作一个总结文字的程序。我有一个问题,如果你把它放入格式化的东西,它在输出中的格式相同。例如,如果你把:

This is a test.
New line here. This isn't a new line.

然后你会得到:

This is a test.
New line here. This isn't a new line.

虽然我希望程序输出:

This is a test. New line here. This isn't a new line.

查看单个句子的输出,看起来也有点奇怪:

2012-09-23 12:21:43.761 Program[5877:303] This is a test
2012-09-23 12:21:43.761 Program[5877:303] 
New line here
2012-09-23 12:21:43.762 Program[5877:303] This isn't a new line

通常情况下,句子前不会有新行。虽然我不希望发布我的算法的代码,但它的基本原理是它通过标点符号对句子进行分离,对它们执行测试,将好的代码重新组合在一起,然后将其输出到NSTextView 。有没有办法从字符串或NSTextView输出中删除所有格式?

0 个答案:

没有答案