StringCollection.st
changeset 14204 435bd4bb0958
parent 14173 636682b78126
child 14244 d107839eb01b
--- a/StringCollection.st	Thu Jul 12 14:08:43 2012 +0200
+++ b/StringCollection.st	Thu Jul 12 14:31:46 2012 +0200
@@ -321,6 +321,30 @@
 
 !StringCollection methodsFor:'special converting'!
 
+decodeFrom: encodingSymbol
+    "given the receiver encoded as described by encodingSymbol,
+     convert it into internal ST/X (unicode) encoding and return a 
+     corresponding StringCollection."
+
+    |myEncoding encoder|
+
+    encodingSymbol isNil ifTrue:[^ self].
+
+    encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:encodingSymbol.
+    encoder isNil ifTrue:[^ self].
+
+    ^ self 
+        collect:[:eachLineOrNil | 
+            eachLineOrNil isNil ifTrue:[
+                eachLineOrNil
+            ] ifFalse:[
+                encoder decodeString: eachLineOrNil
+            ]
+        ]
+
+    "Created: / 12-07-2012 / 14:30:25 / cg"
+!
+
 withTabs
     "return a new stringCollection consisting of the receivers lines,
      where leading spaces are replaced by tabulator characters (assuming 8-col tabs).
@@ -385,9 +409,9 @@
 !StringCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/StringCollection.st,v 1.43 2012-07-10 07:58:31 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/StringCollection.st,v 1.44 2012-07-12 12:31:46 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/StringCollection.st,v 1.43 2012-07-10 07:58:31 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/StringCollection.st,v 1.44 2012-07-12 12:31:46 cg Exp $'
 ! !