Tokenize a string: Difference between revisions
Content added Content deleted
(Logo) |
No edit summary |
||
Line 1: | Line 1: | ||
{{task|Text processing}} |
{{task|Text processing}} |
||
Separate the string "Hello,How,Are,You,Today" by commas into an array (or list) so that each element of it stores a different word. Display the words to the 'user', in the simplest manner possible, separated by a period. To simplify, you may display a trailing period. |
Separate the string "Hello,How,Are,You,Today" by commas into an array (or list) so that each element of it stores a different word. Display the words to the 'user', in the simplest manner possible, separated by a period. To simplify, you may display a trailing period. |
||
=={{header|ActionScript}}== |
|||
<actionscript> |
|||
var hello:String = "Hello,How,Are,You,Today"; |
|||
var tokens:Array = hello.split(","); |
|||
trace(tokens.join(".")); |
|||
// Or as a one-liner |
|||
trace("Hello,How,Are,You,Today".split(",").join(".")); |
|||
</actionscript> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |