Linuxn00b
Linuxn00b

Reputation: 151

How to join an array of strings?

I am having problems attempting to return elements of a String array line by line within a textView. I have indeed used the special carriage return character in my code sequence to return elements of the array on separate lines. However, I have not been able to succeed thus far. Here is a code snippet of what I typed:

txtViewQuestionStatus.text = "\(numCorrect) correct Answers, However these are the questions answered INCORRECTLY: \(model.incorrectItems())\n" //Have text view present number of correct answers and list incorrect Questions line by line.

What could I be doing wrong in my source code? Thanks!

Upvotes: 0

Views: 89

Answers (1)

Stijn van der Laan
Stijn van der Laan

Reputation: 486

What is model.incorrectItems() returning? Can you post that part of your code? If it returns an array of strings you can join them like so:

"... INCORRECTLY: \(model.incorrectItems().joinWithSeparator("\n"))\n"

Upvotes: 2

Related Questions