Q: String To Number Conversion 
Author Message
 Q: String To Number Conversion

Hy APLers,

As an (almost) absolut newbie I having the problem, that I want to convert  
a string, e.g. aStr<-'1234', to a number. How I can I manage that ?

Any help will be appreciated !

-Peter-



Tue, 29 Apr 1997 23:17:26 GMT  
 Q: String To Number Conversion

Quote:
> Hy APLers,

> As an (almost) absolut newbie I having the problem, that I want to convert  
> a string, e.g. aStr<-'1234', to a number. How I can I manage that ?

> Any help will be appreciated !

> -Peter-

number<- execute string
where execute is an intrinsic apl function. on my keyboard it is alt shift ;

Neeraj



Wed, 30 Apr 1997 06:19:16 GMT  
 Q: String To Number Conversion

Quote:
>Hy APLers,

>As an (almost) absolut newbie I having the problem, that I want to convert  
>a string, e.g. aStr<-'1234', to a number. How I can I manage that ?

>Any help will be appreciated !

>-Peter-

Use Execute, e.g., 2+Execute aStr will return 1236.

Olivier Lefevre
NYU Medical School, NYC



Wed, 30 Apr 1997 05:19:55 GMT  
 Q: String To Number Conversion

Quote:
rad/Sp) writes:


Quote:
>> Hy APLers,

>> As an (almost) absolut newbie I having the problem, that I want to convert  
>> a string, e.g. aStr<-'1234', to a number. How I can I manage that ?

>> Any help will be appreciated !

>> -Peter-

>number<- execute string
>where execute is an intrinsic apl function. on my keyboard it is alt shift ;

>Neeraj

just remember that strings which look fine to you might not be what APL
wants to see. For example

        1.234E+001   ( APL doesn't like the '+', 1.234E 001 is ok )

or
        1.23   -2.34   4.56  (the '-' has to be replaced with 'negative')

If you do much of this you'll find your own 'gotchas'.

Also, I've had problems with my system becoming unstable/corrupted when
'execute' gets a string it doesn't like. ( APL2 for OS/2 ). IBM is supposed
to be looking into this for me :-) ( take that as a hint vnet.ibm !)

-------------------------------------------------------------
Tom Corrigan
The Johns Hopkins University / Applied Physics Laboratory



Sun, 04 May 1997 23:11:55 GMT  
 Q: String To Number Conversion

Quote:

> rad/Sp) writes:

> >> Hy APLers,

> >> As an (almost) absolut newbie I having the problem, that I want to convert  
> >> a string, e.g. aStr<-'1234', to a number. How I can I manage that ?

> >> Any help will be appreciated !

> >> -Peter-

> >number<- execute string
> >where execute is an intrinsic apl function. on my keyboard it is alt shift ;

> >Neeraj

> just remember that strings which look fine to you might not be what APL
> wants to see. For example

>    1.234E+001   ( APL doesn't like the '+', 1.234E 001 is ok )

                                                 ^^^^^^^^^^

 1.234E 001 does not work for me.    1.234E001 works

Quote:
> or
>    1.23   -2.34   4.56  (the '-' has to be replaced with 'negative')

The + and - are functions. Execute will try to apply that function to its arguments.
I can change the - sign to the unary minus in the following way
(('-'=aStr)/aStr) <- '-'

where the second '-' is the negative ( unary minus or negation)

For the + sign
aStr <- (~('+'=aStr))/aStr  

and then

aNumber <- Execute aStr    will work.

Quote:

> If you do much of this you'll find your own 'gotchas'.

> Also, I've had problems with my system becoming unstable/corrupted when
> 'execute' gets a string it doesn't like. ( APL2 for OS/2 ). IBM is supposed
> to be looking into this for me :-) ( take that as a hint vnet.ibm !)

try Dyalog APL!


Mon, 05 May 1997 02:53:51 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. BUG: Scientific Number to String/String to Number

2. Problem with STRING to NUMBER conversion

3. number to string .... string to number

4. String to number conversion

5. string to number conversion

6. Conversion of numbers to strings & vice-versa

7. String Number to COMP-2 Conversion Problem

8. STRING NUMBER TO COMP-2 CONVERSION...

9. Number to string conversion without internal writes

10. Help with conversion: number to string

11. 8.0 mishandles conversion of small floating-point numbers to strings

12. Common Lisp: String to Number conversion

 

 
Powered by phpBB® Forum Software