Tokenize a string: Difference between revisions

Content added Content deleted
No edit summary
Line 1: Line 1:
{{task}}
{{task}}
Separate the string "Hello,How,Are,You,Today" by commas into an array so that each index of the array 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 so that each index of the array 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.

==[[JavaScript]]==
[[Category:JavaScript]]
'''Interpreter:''' Firefox 2.0

var str = "Hello,How,Are,You,Today";
var tokens = str.split(",");
alert( tokens.join(".") );


==[[Perl]]==
==[[Perl]]==