相关疑难解决方法(0)

从NSString的第一行删除换行符

如何从NSString中删除第一个\n字符?

编辑:只是为了澄清,我想要做的是:如果字符串的第一行包含\n字符,删除它否则什么都不做.

ie:如果字符串是这样的:

@"\nhello, this is the first line\nthis is the second line"
Run Code Online (Sandbox Code Playgroud)

并且与第一行中不包含换行符的字符串相反:

@"hello, this is the first line\nthis is the second line."
Run Code Online (Sandbox Code Playgroud)

我希望这更清楚.

iphone macos cocoa objective-c nsstring

16
推荐指数
3
解决办法
2万
查看次数

标签 统计

cocoa ×1

iphone ×1

macos ×1

nsstring ×1

objective-c ×1