Trouble with newline character while programming f

2019-09-11 07:08发布

I'm storing text in a sqlite file and setting the text of a UITextView to be the value of that text. The only problem is that the UITextView isn't honoring the newline character. Instead, it's printing it out as text. Here's an example:

Stored in fruit.sqlite and passed to theFruit object:
requiredFruit = "apples\n oranges\n pears"

NSString *theFruit = [NSString stringWithFormat:@"%@", theFruit.requiredFruit];
generalOutlet.text = theFruit;

It Displays apples\n oranges\n pears but I want it to display

  • apples
  • oranges
  • pears

1条回答
一纸荒年 Trace。
2楼-- · 2019-09-11 07:34

Preventing sqlite from escaping backslash

sqlite files are WYSIWYG format apparently. I used a text editor to write an sql update statement and just used the return key when typing out the list. I then read that file from terminal and it seems to have worked out.

查看更多
登录 后发表回答