TI-BASIC:String To List
Routine Summary
Converts a string to a list of numbers.
Inputs
Str1 - The string you want to convert
Outputs
L₁ - The list that the numbers are stored to
Variables Used
L₁, A, Str1
Calculator Compatibility
TI-83/84/+/SE Author
@@Authors
@@URL: [@@] Download
:~1+seq(inString("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ",sub(Str1,A,1)),A,1,length(Str1→L₁
With our characters stored in Str1, we loop through each character and store its position in our reference string (the uppercase alphabet) to the respective element of L₁.
This routine only allows for values from 1 to 26 in the list, since our string of characters is the uppercase alphabet, and each list value must match up to one of the string positions. If you add more characters to the string, however, you can increase the range of values in the list. This routine uses Str1, so you should clean it up at the end of your program.
Advanced Routine
Since a list element can store up to 14 digits, you can use int(, fPart(, and exponents to compress an additional 7 letters per element (2 digits for each letter), thus increasing your total number of characters to 6993.
" ABCDEFGHIJKLMNOPQRSTUVWXYZ->Str0 DelVar L1 For(A,0,dim(L1 0 For(B,1,min(7,length(Str1)-7A Ans+.1^(2B)inString(Str0,sub(Str1,B+7A,1 End Ans->L1(A+1 End "