Indexing into a string - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Indexing into a string (/thread-9396.html) |
Indexing into a string - webmasterpdx - 10-30-2017 09:18 AM 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 RE: Indexing into a string - webmasterpdx - 10-30-2017 09:37 AM 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? RE: Indexing into a string - webmasterpdx - 10-30-2017 09:51 AM 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". RE: Indexing into a string - DrD - 10-30-2017 10:06 AM 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); RE: Indexing into a string - webmasterpdx - 10-30-2017 03:04 PM 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). |