Jump to content

Tokenize a string: Difference between revisions

m (→‎{{header|Haskell}}: The wiki interpreted part of the program as Wikilink, which clearly wasn't intended)
Line 327:
=={{header|Smalltalk}}==
|array |
array := ('Hello,How,Are,You,Today' findTokenssubStrings: $,) asArray.
array fold: [:concatenation :string | concatenation, '.', string , '.'])
Transcript show:
 
(array inject: ''
Some implementations also have a ''join:'' convenience method that allows the following shorter solution:
into:
 
[:concatenation :string | concatenation , string , '.'])
('Hello,How,Are,You,Today' subStrings: $,) join: '.'
 
The solution displaying a trailing period would be:
 
|array |
array := 'Hello,How,Are,You,Today' subStrings: $,.
array inject: '' into: [:concatenation :string | concatenation, string, '.' ]
 
=={{header|Standard ML}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.