Post Reply 
newline not parsed in strings [Android]
09-04-2015, 06:32 PM
Post: #1
newline not parsed in strings [Android]
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;

Stephen Lewkowicz (G1CMZ)
It's the last week I have the freedom of Europe
Visit this user's website Find all posts by this user
Quote this message in a reply
09-04-2015, 06:45 PM
Post: #2
RE: newline not parsed in strings [Android]
(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;

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
09-04-2015, 07:01 PM
Post: #3
RE: newline not parsed in strings [Android]
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.

Stephen Lewkowicz (G1CMZ)
It's the last week I have the freedom of Europe
Visit this user's website Find all posts by this user
Quote this message in a reply
09-04-2015, 07:26 PM
Post: #4
RE: newline not parsed in strings [Android]
(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.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
09-04-2015, 07:48 PM
Post: #5
RE: newline not parsed in strings [Android]
(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.

Stephen Lewkowicz (G1CMZ)
It's the last week I have the freedom of Europe
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)