[Oz] Convert String to Int

Ralf Scheidhauer scheidhr at dfki.de
Wed Jan 20 09:25:47 CET 1999


>> 
>> Dear Oz users,
>> 
>> I'm using Mozart 1.0.0 of Dec 10 1998  and I have a little problem to convert 
>> string to int. When I use {String.toint "80"}, the result is 80
>> but when I try {String.toInt "080"}, then result is :
>> 
>> %******************* Error: representation fault ****************
>> %**
>> %** Conversion to integer failed
>> %**
>> %** String: "080"
>> %** In statement: {<P/2 String.toInt> [48 56 48] _}
>> %**
>> %** Call Stack:
>> %** toplevel abstraction in line 1, column 0, PC = 138869340
>> %**--------------------------------------------------------------
>> 
>> Can anyone help me. Is it a bug ? Is this bug cerrect in the new version ?

This is not a bug: if the string representation of an integer starts
with a zero it expects an octal representation. Thus the characters
following the zero must be in the range 0..7. See

    http://mozart/documentation/notation/node2.html#chapter.lexical

for more information.


Ralf

--
Ralf Scheidhauer                   Tel:    +49 681 302-5619
Programming Systems Lab, DFKI GmbH Fax:    +49 681 302-5615
Universität des Saarlandes,        Mobile: +49 172 6758800
Postfach 15 11 50                  Email:  scheidhr at dfki.de
D-66041 Saarbrücken, Germany       WWW:    http://www.ps.uni-sb.de/~scheidhr

-
Please send submissions to oz-users at dfki.de,
administriva mail to oz-users-request at dfki.de.
The Oz web site is at http://www.ps.uni-sb.de/oz/.





More information about the mozart-users mailing list