#DOCUMENTATION by cg
authorClaus Gittinger <cg@exept.de>
Sun, 06 May 2018 13:12:45 +0200
changeset 4085 815d85b10332
parent 4084 c8e84f0ba64e
child 4086 de7c2d6148e1
#DOCUMENTATION by cg class: PrintConverter comment/format in: #initForIntegerOrNil #initForNumberOrNil changed: #initForYesNo
PrintConverter.st
--- a/PrintConverter.st	Tue May 01 10:39:23 2018 +0200
+++ b/PrintConverter.st	Sun May 06 13:12:45 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
 	      All Rights Reserved
@@ -386,11 +388,16 @@
     "initialize to convert to/from an integer 
      - if the string is empty or invalid, convert to nil"
 
-    valueToStringBlock := [:num | 
-	num isNil ifTrue:[''] 
-		  ifFalse:[num printString]].
-    stringToValueBlock := [:string | 
-	Integer readFromString:string onError:nil]
+    valueToStringBlock := 
+        [:num | 
+            num isNil 
+                ifTrue:[''] 
+                ifFalse:[num printString]
+        ].
+    stringToValueBlock := 
+        [:string | 
+            Integer readFromString:string onError:nil
+        ]
 !
 
 initForNumber
@@ -405,22 +412,22 @@
     "initialize to convert to/from a number 
      - if the string is empty or invalid, convert to nil"
 
-    valueToStringBlock := [:num | 
-        num isNil ifTrue:[''] 
-                  ifFalse:[num printString]].
-    stringToValueBlock := [:string |
-        |s|
+    valueToStringBlock := 
+        [:num | 
+            num isNil 
+                ifTrue:[''] 
+                ifFalse:[num printString]
+        ].
+    stringToValueBlock := 
+        [:string |
+            |s|
 
-        s := string.
-        (s endsWith:'.') ifTrue:[
-            s := s , '0'
-        ].
-        Number readFromString:s onError:nil
-    ]
-
-
-
-
+            s := string.
+            (s endsWith:'.') ifTrue:[
+                s := s , '0'
+            ].
+            Number readFromString:s onError:nil
+        ]
 !
 
 initForString
@@ -452,9 +459,14 @@
      (i.e. if german, ja/nein has to be entered.
      Invalid entries are converted to false."
 
-    valueToStringBlock := [:bool | bool ifTrue:[ApplicationModel classResources string:'yes']
-                                        ifFalse:[ApplicationModel classResources string:'no']].
-    stringToValueBlock := [:string | string = (ApplicationModel classResources string:'yes')]
+    valueToStringBlock := 
+        [:bool | 
+            ApplicationModel classResources string:(bool ifTrue:['yes'] ifFalse:['no'])
+        ].
+    stringToValueBlock := 
+        [:string | 
+            string = (ApplicationModel classResources string:'yes')
+        ]
 !
 
 toPrint:printBlock toRead:readBlock