Tokenize a string: Difference between revisions

Content added Content deleted
No edit summary
Line 138: Line 138:
my @words = split(/,/, "Hello,How,Are,You,Today");
my @words = split(/,/, "Hello,How,Are,You,Today");
print $_.'.' for (@words);
print $_.'.' for (@words);

==[[PHP]]==
[[Category:PHP]]
'''Interpreter:''' [[PHP]] any 5.x

<?php
$str = 'Hello,How,Are,You,Today';
$arr = array_fill_keys(explode(',', $str), 0);
echo implode('.', array_keys($arr));
?>


==[[Python]]==
==[[Python]]==