HP Forums

Full Version: newline not parsed in strings [Android]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Example in the User guide suggest that \n is parsed as a newline escape sequence (of size 1).
Using the 092 backslash between the square brackets in the Shift/Vars table, the \n is not parsed as an escape sequence and is printed as normal text.

What am I doing wrong?
Code:

 EXPORT BS()
BEGIN
 PRINT("A\nB");
END;
(09-04-2015 06:32 PM)StephenG1CMZ Wrote: [ -> ]Example in the User guide suggest that \n is parsed as a newline escape sequence (of size 1).
Using the 092 backslash between the square brackets in the Shift/Vars table, the \n is not parsed as an escape sequence and is printed as normal text.

What am I doing wrong?
Code:

 EXPORT BS()
BEGIN
 PRINT("A\nB");
END;

You can just use enter:

Code:
 EXPORT BS()
BEGIN
 PRINT("A
B");
END;
This appears to work too:
Code:

LOCAL LF:=CHAR(10);
PRINT("a"+LF+"b");
Which would be more useful if you wanted a variable number of lines.
LF is the line feed character, but it actually has the effect of a Carriage Return too within the PRINT.

SO
(1) why doesn't \n newline?
(2) what if I actually wanted just a line feed? So that B is positioned after A but 1 line down, rather than 1 line down and to the left.
(09-04-2015 07:01 PM)StephenG1CMZ Wrote: [ -> ](1) why doesn't \n newline?

It is actually leftover from the 39gII and the feature/documentation is not in sync at the moment. It is on "the list" for correction though at some point in the future.
(09-04-2015 07:26 PM)Tim Wessman Wrote: [ -> ]
(09-04-2015 07:01 PM)StephenG1CMZ Wrote: [ -> ](1) why doesn't \n newline?

It is actually leftover from the 39gII and the feature/documentation is not in sync at the moment. It is on "the list" for correction though at some point in the future.

Thanks for that explanation. I had thought I must have selected the wrong backslash or something. The use of line feed provides an effective workaround.
Reference URL's