Post Reply 
newRPL: Adding string processing commands?
09-02-2017, 07:37 PM
Post: #14
RE: newRPL: Adding string processing commands?
(08-31-2017 03:15 AM)Claudio L. Wrote:  String management is complete. Those 2 commands will not be implemented, they are being replaced with →UTF8 and UTF8→. The main reason to rename them is to remind people that you are no longer reading a byte from the string, but decoding/encoding a Unicode code point.
*EDIT*: I just recalled that I renamed them also because CHR creates a DOCHAR object, which doesn't exist in newRPL.
Other commands are:
SREPL
→UTF8
UTF8→
SREV
NTOKENS
NTHTOKEN
NTHTOKENPOS
TRIM
RTRIM
STRLEN
STRLENCP
→NFC
POS
POSREV
NPOS
NPOSREV

I noticed that →UTF8 and its inverse behave opposite to what I'd expect based on →STR and its inverse. For example:
25.6 →STR yields "25.6"

so similarly I'd expect:
#61h UTF8→ to yield "a", but instead it throws an error, since it is currently works opposite of what I'd expect,
#61h →UTF8 yields "a"

I intuitively substitute the following when using the STR commands:
→STR, convert object to string
STR→, convert string to object
but this doesn't work for the UTF8 commands. I'd rather it be:
→UTF8, convert object to UTF8
UTF8→, convert UTF8 to object

-Steve
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL: Adding string processing commands? - smartin - 09-02-2017 07:37 PM



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