Indexing into a string
|
10-30-2017, 09:18 AM
Post: #1
|
|||
|
|||
Indexing into a string
I'm currently working with strings and something very inconsistent is going on.
Lets say I have a string, s, that is something like "This is a very nice day". However, when I use s(3), it returns a number instead of "i". I have to use CHAR(s(3)) to get the character. Surely an index into a string should return a string. Is there a faster way to index into a string to return a string? Anyone know? Thanks -Donald |
|||
10-30-2017, 09:37 AM
Post: #2
|
|||
|
|||
RE: Indexing into a string
I also discovered an at() and of() functions that seem to have something to do with strings, but for which there is no documentation. Can these be of use?
|
|||
10-30-2017, 09:51 AM
Post: #3
|
|||
|
|||
RE: Indexing into a string
I think I've got it!
It's s(3,1) gets 1 character from s at position 3....returns "e" if s contains "The dog". |
|||
10-30-2017, 10:06 AM
Post: #4
|
|||
|
|||
RE: Indexing into a string
Quote:I also discovered an at() and of() functions that seem to have something to do with strings, but for which there is no documentation. Can these be of use? The zero'th list index is also useful. It points to the tail of a list, where the last element can be returned, deleted, or a new element appended to the list. Example: L1:={4,9,16}; L1(0):=√(L1); |
|||
10-30-2017, 03:04 PM
Post: #5
|
|||
|
|||
RE: Indexing into a string
at(M,I) is a function to index a matrix or string, etc.. or M[I].
of(f,x) is the same as f(x). |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)