Apostrophes/Quotation marks from loadStrings()?

I have a lot of larger blocks of text for my recent project, and I wanted to use a .txt file and loadStrings() to store/use them. However, the apostrophes and quotation marks in the text won't display correctly. I tried adding the usual backslash, but then the backslash is just displayed next to the unloaded character. This has happened both when using println() and text(). Any suggestions?

Original text:

Plastic can’t be broken down by marine microorganisms, so while plastic debris gets smaller, it doesn’t go away. “Ocean confetti” has been found in every area and depth of the ocean, and we still don’t know much about its effects.

Code:

        void setup() {
              /*loading text into a string array (I have a lot, but only one has apostrophes and 
              quotation marks so I'll just use lines[4]*/
              String[] lines = loadStrings("strings.txt");
              //dislay text
              println(lines[5]);
            }

Output: Screen Shot 2017-04-01 at 6.55.39 PM

Output when I add backslashes in the .txt file: Screen Shot 2017-04-01 at 6.59.22 PM

Tagged:

Answers

Sign In or Register to comment.