newline not parsed in strings [Android]
09-04-2015, 06:32 PM
Post: #1
 StephenG1CMZ Senior Member Posts: 816 Joined: May 2015
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)
09-04-2015, 06:45 PM
Post: #2
 eried Senior Member Posts: 739 Joined: Dec 2013
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
09-04-2015, 07:01 PM
Post: #3
 StephenG1CMZ Senior Member Posts: 816 Joined: May 2015
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)
09-04-2015, 07:26 PM
Post: #4
 Tim Wessman Senior Member Posts: 2,204 Joined: Dec 2013
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.
09-04-2015, 07:48 PM
Post: #5
 StephenG1CMZ Senior Member Posts: 816 Joined: May 2015
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)
 « Next Oldest | Next Newest »

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