PrintConverter.st
changeset 411 8b8b0128d129
parent 407 7dedb9b0f157
child 1191 fdc4454013e4
equal deleted inserted replaced
410:2d21748e0d9c 411:8b8b0128d129
   390 initForNumberOrNil
   390 initForNumberOrNil
   391     "initialize to convert to/from a number 
   391     "initialize to convert to/from a number 
   392      - if the string is empty or invalid, convert to nil"
   392      - if the string is empty or invalid, convert to nil"
   393 
   393 
   394     valueToStringBlock := [:num | 
   394     valueToStringBlock := [:num | 
   395 	num isNil ifTrue:[''] 
   395         num isNil ifTrue:[''] 
   396 		  ifFalse:[num printString]].
   396                   ifFalse:[num printString]].
   397     stringToValueBlock := [:string | 
   397     stringToValueBlock := [:string |
   398 	Number readFromString:string onError:nil]
   398         |s|
       
   399 
       
   400         s := string.
       
   401         (s endsWith:'.') ifTrue:[
       
   402             s := s , '0'
       
   403         ].
       
   404         Number readFromString:s onError:nil
       
   405     ]
       
   406 
       
   407 
       
   408 
       
   409 
   399 !
   410 !
   400 
   411 
   401 initForString
   412 initForString
   402     "initialize for a string - this is trivial"
   413     "initialize for a string - this is trivial"
   403 
   414 
   428 ! !
   439 ! !
   429 
   440 
   430 !PrintConverter class methodsFor:'documentation'!
   441 !PrintConverter class methodsFor:'documentation'!
   431 
   442 
   432 version
   443 version
   433     ^ '$Header: /cvs/stx/stx/libview2/PrintConverter.st,v 1.15 1997-02-11 10:54:23 ca Exp $'
   444     ^ '$Header: /cvs/stx/stx/libview2/PrintConverter.st,v 1.16 1997-02-11 19:08:41 ca Exp $'
   434 ! !
   445 ! !