Skip to content
Advertisement

How to get text before carriage return

I’m loading the following JSON into my program:

JavaScript

I want to extract the substring “apple foo text” with:

JavaScript

But it only returns hello world. I know it is because of the carriage return statement, but I’m not sure how to to print the substring before. How would I get just the text before the statement? Any help would be appreciated.

Advertisement

Answer

To navigate to string, you’re using:

JavaScript

To get the desired substring split text on carriage return.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement