Re: TIB: Extracting data from a string


[Prev][Next][Index][Thread]

Re: TIB: Extracting data from a string




The correct sub( ) expression is:

sub(bigstr, partition# * partitionsize + 1, partitionsize)

The +1 is necessary because the character positions start at 1, not at zero.

This is the method I used for TI-83 Phone Book.

>From: "C.J. Wallace" <circax@hotmail.com>
>Reply-To: ti-basic@lists.ticalc.org
>To: ti-basic@lists.ticalc.org
>Subject: Re: TIB: Extracting data from a string
>Date: Thu, 15 Jun 2000 13:11:34 EDT
>
>
>Ok, I only have an 83, but this should go for the 86 as well.  What I would
>do is have set maximum lengths that string data (not the length of the
>entire string, just an entry in the String). To do this, you just test the
>length of the data, and if it fits in whatever size parition you want, then
>just store it to wherever the next parition would start.  Like this:say you
>want a parition length of 5; and the first entry was: "BOB"  The string
>would look like this: "BOB_ _" (_=space).  Then the next entry would be
>"MANDY"  The string would look like this: "BOB_ _MANDY"  And so on, you
>could get something like this: "BOB_ _MANDYDOUG_555554444_333_ _22_ _ _1_ _
>_ _"
>
>So, all you have to do when when extracting is (provided you've formatted
>your data str to set segments)  All you have to do is know at which 
>parition
>that data is in, multiply that number by the size of the parition, and
>perform a sub( operation, with the length of it as the sizr of the 
>parition:
>sub(BIGSTR,PARITION#*PARITIONSIZE,PARITIONSIZE)  At least, thats how the
>sub( command works on the 83. .. .
>
>Did you understand?
>
>>I'm writing an address book program, and have come to the
>conclusion that
>>the only way to manage a large amount of data would be from a big string
>>and
>>a big list. I've made a little program that can extract text from a list,
>>that goes a bit like this [BTW: the stuff enclosed in quotes are comments,
>>they screw up the Ans var but who cares. {this is for the 86}]
>>
>>"<Sample Info...>"
>>"Hellothisisalargelist" -> BIGSTRING
>>{5,4,2,1,5,4} -> BIGLIST
>></Sample Info...>"
>>
>>While dimL BIGLIST > 1
>>BIGLIST(dimL BIGLIST) -> ENDSTR
>>sum BIGLIST+1 -> BEGINSTR
>>sum BIGLIST-1 -> dimL BIGLIST
>>sub(BIGSTRING,BEGINSTR,ENDSTR) -> SHOWstr
>>
>>"<Show the string>"
>>Disp SHOWstr
>>"</Show the string>"
>>
>>End
>>
>>"<Get the very first word>"
>>sub(BIGSTRING,1,BIGLIST(1))-> SHOWstr
>>Disp SHOWstr
>>Return
>>
>>Okay, this was difficult (for me) but here's the part that stumps me is 
>>how
>>to extract like, 1 address book entry from a string and a list. What I've
>>got above extracts data from an entire string, but not just a bit of it.
>>:-(
>>
>>
>>
>>--
>>o w e n  c a n n o n
>>owencannon@mac.com
>>http://homepage.mac.com/owencannon
>>
>>
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com