How to Verify the Output of an Escape Sequence

Asked 1 years ago, Updated 1 years ago, 91 views

var string2=String()
string2+="\"Swift\"\n\tNew language"// Insert line feed code and tab

Line breaks and tabs don't reflect well. Why?

Enter a description of the image here

Thank you for your reply.
I checked the confirmation screen from the gray area on the side.I'm thinking that the output of the program will only be reflected there.
As per the attached photo, is it the correct way to check that it is reflected from the log screen?
If so, could you tell me how to check it?
 There are a lot of frame# written right now...

swift3

2022-09-30 21:23

2 Answers

I checked the confirmation screen from the gray area on the side.I'm thinking that only the output of the program will be reflected there.

Playground provides three ways to check the value of a variable, rather than a "confirmation screen.The gray area next to you is always displayed.The second one is a quick look.

Enter a description of the image here

Click the eye-shaped icon in the screenshot above to see it.
The third one is called Result, which appears inline in the editor when you click the icon at the end of the arrow in the screenshot above.(Picture below)

Enter a description of the image here

This is actually the most Playground-like part, such as graphing an array of numbers.There's nothing you can do without it.


2022-09-30 21:23

Nice to meet you.Why was it confirmed that line breaks and tabs are not reflected?

I checked the playground of Xcode 8.2.1 and the log at the bottom of the attached screen (printed by the print statement) seems to have been correctly broken and tabbed.
There is a high possibility that the system that displays string2 does not support a new line, and it is not considered valid.
Enter a description of the image here

The question has been updated, so it is a supplement.
The log screen at the bottom of the screen shows the execution log as the name suggests.
I don't know why there is an error, but the contents of the variable are displayed on the log screen
The print statement is required for output.

The contents are also displayed on the right side of the code editing screen for monitoring variable values.
I think that the regular expression escape is displayed without expanding it.

Expand escape expressions such as \n and \t as promised. As it is a display system, the gray monitor on the right side just displays the text as it is
Now, to see what strings are stored, use the escape expression
I think it's displayed in a non-deployable way.


2022-09-30 21:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.