Re: How do I ...


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

Re: How do I ...



>   Hi,
>
>         Does anyone know how I can get a single digit out of a string
> on a 82
> i.e.
> 10500->A
>
> how would I get the 5 out of that number.
>
a)
10500 is not a string, it is a number, {1, 0, 5, 0, 0} or L1, L2 , etc are
lists which is as close to a string as the 82 gets. to get a value from a list
do the following
    {1, 0, 5, 0, 0} -> L1
    L1(3)


b)
since you ask about a number I will try to extract the number


10500 -> A


where an index is as follows
1 0 5 0 0
5 4 3 2 1
Prgm:INDEXA
:Input "INDEX", B
:(iPart (A/(10^B))) - ((iPart (A/(10^(B+1)))) * 10) -> C
{we move the index we want to find to the ones position,
then we subtract the that from the same number with a zero in the ones.}
:Disp C




----
TC
"Do not worry about your problems in mathmatics,
 I can assure you that mine are still greater"
                                       -Albert Einstein


References: