Re: TIB: string to variable


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

Re: TIB: string to variable



>> How would I convert  A+B+C+D+E into a variable
>>named HELLO if my program looks  like this:
>> "H"->A
>> "E"->B
>> "L"->C
>> "L"->D
>> "O"->E
>> If I type A+B+C+D+E=6 or 6->A+B+C+D+E at the end
>>of the program then I get a Error 10 data type
>>message.
>
>A+B+C+D+E->HELLO

I think what he's asking is if it's possible to create a variable based
upon the characters in a string.  like:

"ThIs"->thAT
and then being able somehow to store something into the variable ThIs by
using the string variable thAT.  If this is what you're asking, I'm sorry
this is not possible.  What you are attempting to do is kindof like using
a pointer (if you don't know what that is, I suggest looking it up in a
C++ book).

But this might be something you can use.  You can have a variable "point"
to different variables.  ie:

">>" will stand for that filled in triangle used in conversions,
etc...(excluding the quotes)


:1->ThIs
:2->thAT
:[1,2->theOther

:"ThIs"->pointer
:St>>Eq(pointer,pointer
:6->ThIs
:Disp pointer
                   6 is displayed

:"thAT"->pointer
:St>>Eq(pointer,pointer
:7->thAT
:Disp pointer
                   7 is displayed

:"theOther"->pointer
:St>>Eq(pointer,pointer
:[8,9->theOther
:Disp pointer
                   [8,9] is displayed

a note about the last one: pointer is not, I repeat, _NOT_ a vector! 
It's an equation.  This may seem silly, but I had problems with this
until I realized this.  I'll give an example:

if you tried to index a value
:Disp pointer(1)
                  [8,9] would be displayed
:Disp pointer(2)
                  [16,18] would be displayed
This doesn't make much sense at first, but think about it.  Only vectors,
arrays, and the like data types can be indexed, but when you try to index
a variable of the equation data type, implied multiplication results.  If
you need to access a value by index then you must store it to a variable
first, but if you store it to itself then it will no longer point to the
value in the other variable.  You probably should store it to another
temporary variable to index it.


This probably doesn't help your problem of storing variables.  Ok, here
might be a solution:

:1->HELLO
:2->ThIss
:3->thATT
:4->theOt
:[0,0,0,0->pointer
     going back to your original code...
:"H"->A
:"E"->B
:"L"->C
:"L"->D
:"O"->E
      and now getting it to work
:A+B+C+D+E->index
:St>>Eq(index,index
:6->pointer(index


it would be better if you could do:
"HELLO"->index
and this method will only work if you know the possible variables
beforehand.  If you can't use this method then I don't know any other
way.


Sincerely,
The Unibomer

Jared Ivey
Unibomer@Juno.com
Ham Call Sign: KF4BXL
The Unibomer's Shack:
     http://www.geocities.com/SiliconValley/Vista/7342/
 _______________________
|  Florida Times Union  |
|=======================|
| Unibomer Strikes Again|
|   ~~~~~~~~~~~~~~~~~~~ |
| ~~~~~~~~~~~~~~~~~~~~~ |
| ~~~~~~~~~~~~~~~~~~~~~ |
| ~~~~~~~~~~~~~~~~~~~~~ |
| ~~~~~~~~~~~~~~~~~~~~• |
|_______________________|


Follow-Ups: References: