We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e913aca + 75c1ebc commit 6d18367Copy full SHA for 6d18367
dev/src/Exercise@AtbashCipher/AtbashCipher.class.st
@@ -36,14 +36,14 @@ AtbashCipher >> sanitizeString: aString [
36
]
37
38
{ #category : #splitjoin }
39
-AtbashCipher >> splitInGroupsOfFive: aString [
40
- aString size < 6
41
- ifTrue: [ ^ aString ].
42
- ^ String streamContents: [ :stream |
43
- aString doWithIndex: [ :each :i |
44
- (i > 1 and: [ i - 1 isDivisibleBy: 5 ])
45
- ifTrue: [ stream << Character space ].
46
- stream << each ] ]
+AtbashCipher >> splitInGroupsOfFive: stringToSplit [
+ |input|
+ input := ReadStream on: stringToSplit.
+ ^ String streamContents: [ :output |
+ output << (input next: 5).
+ [ input atEnd ] whileFalse: [ output space << (input next: 5) ]
+ ].
+
47
48
49
{ #category : #encoding }
0 commit comments