Post Reply 
Getting character number from String entry.
03-22-2022, 06:04 PM
Post: #1
Getting character number from String entry.
Is there a way to get a single character identifier for a single letter of a string at a time?

ASC seems like it would do it, but it outputs a list.

If ASC is the only way to get it, then is there a way to extract the single entry in a list, as a single number?
Find all posts by this user
Quote this message in a reply
03-22-2022, 08:48 PM
Post: #2
RE: Getting character number from String entry.
(03-22-2022 06:04 PM)matalog Wrote:  Is there a way to get a single character identifier for a single letter of a string at a time?

with s:="ABCDE"
s(3) will return 67
s(3,1) will return "C"
s(3,2) will return "CD"
Find all posts by this user
Quote this message in a reply
03-22-2022, 10:21 PM
Post: #3
RE: Getting character number from String entry.
(03-22-2022 08:48 PM)Didier Lachieze Wrote:  
(03-22-2022 06:04 PM)matalog Wrote:  Is there a way to get a single character identifier for a single letter of a string at a time?

with s:="ABCDE"
s(3) will return 67
s(3,1) will return "C"
s(3,2) will return "CD"

Great, thanks.
Find all posts by this user
Quote this message in a reply
03-23-2022, 12:02 PM
Post: #4
RE: Getting character number from String entry.
Actually, where in the manual is that particular ability/feature described. That a string referred to as M(1) will return the ascii character number, and referred to with M(1,1) will return the string character?
Find all posts by this user
Quote this message in a reply
03-24-2022, 04:48 AM
Post: #5
RE: Getting character number from String entry.
(03-23-2022 12:02 PM)matalog Wrote:  Actually, where in the manual is that particular ability/feature described.

Indirectly in the section "List references" of the manual:
Quote: List references
Suppose L1:={5, "abcde", {1,2,3,4,5}, 11}. L1(1) returns 5 and L1(2) returns "abcde". L1(2, 4) returns 100 (the ASCII code for d) and L1(2,4,1) returns "d".
Find all posts by this user
Quote this message in a reply
Post Reply 




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