Post Reply 
[QUESTION] "internal string table"
12-07-2016, 01:48 PM (This post was last modified: 12-07-2016 03:17 PM by compsystems.)
Post: #1
[QUESTION] "internal string table"
Hello HP-PRIME programmers and users

The STRINGFROMID cmd says

Quote:STRINGFROMID
Syntax: STRINGFROMID(integer) Returns, in the current language, the built-in string associated in the internal string table with the specified integer.
Examples: STRINGFROMID(56) returns “Complex” STRINGFROMID(202) returns “Real”

Where is the "internal string table"?
I can not find in the user guide the "internal string table" interger values
Find all posts by this user
Quote this message in a reply
12-07-2016, 05:46 PM
Post: #2
RE: [QUESTION] "internal string table"
They are not documented...
A simple FOR loop will show the strings on your system.

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
12-07-2016, 09:24 PM (This post was last modified: 12-07-2016 09:36 PM by compsystems.)
Post: #3
RE: [QUESTION] "internal string table"
Thanks, I want to create an output string where each line can be displayed independently, it seems that CAR (10) "\n" does not do what I want when copy in a text editoras notepad++

test
PHP Code:
EXPORT id2str()
BEGIN
 LOCAL int
str;
 
str:=""
 print();
 print( 
"*****  *****" );   
 for 
int from 1 to 50 do 
   print( 
int " :"  STRINGFROMID(int) );
   
str:= str char(10) + int " :"  STRINGFROMID(int);
   
wait(); // line by line printing
 
end
 return 
str;
END

Quote:"\n1 :The password is invalid\n2 :Program Catalog\n3 :Sto ▶\n4 :Echo\n5 :Cancel\n6 :OK\n7 :Characters\n8 :Exam\n9 :Exam Mode Configuration\n10 :Page\n11 :Select a character and press OK\n12 :More\n13 :Edit\n14 :Choose\n15 :✓\n16 :✓\n17 :Angle Measure\n18 :Number Format\n19 :Separators\n20 :Complex\n21 :Radians\n22 :Degrees\n23 :Choose angle measure\n24 :Standard\n25 :Fixed\n26 :Scientific\n27 :Engineering\n28 :Rounded\n29 :Floating\n30 :Fraction\n31 :Mixed Fraction\n32 :Choose format for numbers\n33 :Choose decimal places to display\n34 :Choose digits to display\n35 :Dot (.)\n36 :Comma (,)\n37 :Choose decimal mark character\n38 :Allow complex output from real input\n39 :Home Settings\n40 :CAS Settings\n41 :Choose number of digits to use\n42 :Recursive Evaluation\n43 :Maximum recursive variable evaluations\n44 :Recursive Replacement\n45 :Maximum recursive variable replacements\n46 :Epsilon\n47 :Enter ε limit for conversion to 0\n48 :Recursive Function\n49 :Maximum recursive function calls\n50 :Probability"
Find all posts by this user
Quote this message in a reply
12-07-2016, 09:43 PM
Post: #4
RE: [QUESTION] "internal string table"
(12-07-2016 09:24 PM)compsystems Wrote:  Thanks, I want to create an output string where each line can be displayed independently, it seems that CAR (10) "\n" does not do what I want when copy in a text editoras notepad++

It seems print("1\n2") prints two lines just fine on my setup. Also, print("1" + char(10) + "2") also works. Creating a string: str:="1" + CHAR(10) + "2" also works (copy the string from the stack and it appears in the command line as "1\n2"). On the calculator display, however, you won't see a newline character as strings are just printed as a single horizontal line of (visible) characters. In the HP48 calculators, CHAR(10) is just displayed as a black square inside a string. I believe on the Prime, it is suppressed.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-07-2016, 09:59 PM
Post: #5
RE: [QUESTION] "internal string table"
Instead of return str; have you tried to store the strings in a Note with something like: Notes("IDSTRINGS"):=str; ?
Find all posts by this user
Quote this message in a reply
12-09-2016, 01:21 PM
Post: #6
RE: [QUESTION] "internal string table"
(12-07-2016 09:59 PM)Didier Lachieze Wrote:  Instead of return str; have you tried to store the strings in a Note with something like: Notes("IDSTRINGS"):=str; ?

I have not worked with NOTES, someone please adhere to the code above, this way I learn =)

Thanks
Find all posts by this user
Quote this message in a reply
12-09-2016, 09:43 PM (This post was last modified: 12-09-2016 09:44 PM by Han.)
Post: #7
RE: [QUESTION] "internal string table"
As I already explained, the HP screen shows strings as a single line since newlines are suppressed. It doesn't mean that there was any bug in the variable str. However, since you are copying the result from the display stack, you are copying the display version of your string variable and not the actual contents. You can check for yourself.

1. Make str an exported variable instead of a local variable.
2. In the Home view, type str and press enter. Your string will not show the newlines. Copying this to the command confirms this.
3. However, the str variable itself contains the newlines. Just type str(1) and it returns 10, the character number of the newline character. And type in char(str(2)) and you will see the next characters of the text saved in str.

EDIT: Didier has offered a perfectly fine example of how to extract the contents of your str variable for copying. It basically saves it as a note, found by pressing [Shift] [0]

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
04-19-2017, 01:56 PM
Post: #8
RE: [QUESTION] "internal string table"
Extracted in a .txt (Unicode) with the following code:

PHP Code:
// Use Number Format: Standard

EXPORT STRINGFRROMID_TXT
BEGIN

 LOCAL Tx
,x,Nmb="STRINGFROMID_"+Language+".txt";

 
DelAFiles(Nmb);
 
AFilesB(Nmb,0):={255,254};

 FOR 
x:=0 TO 2996 DO
  
Tx:=x+"\t"+STRINGFROMID(x)+"\r\n";
  
LOCAL y,Nvo={};
  FOR 
y:=1 TO DIM(Tx) DO
   
Nvo(0):=Tx(y);
   
Nvo(0):=BITSR(Tx(y),8)
  
END;
  
AFilesB(Nmb,AFilesB(Nmb)):=Nvo
 END
;

 
"Success!"
END

Download files txt:
1 English
2 中文 (简体)
3 Français
4 Deutsch
5 Español
6 Nerderlands
7 Português
8 日本語

Also a small example of animation, where that command is used to create variety: Video

Viga C | TD | FB
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)