Tokenize a string: Difference between revisions
Content added Content deleted
(Undo revision 101104 by 75.108.178.227 (talk) wrong) |
(added Fantom example) |
||
Line 313: | Line 313: | ||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
<lang factor>"Hello,How,Are,You,Today" "," split "." join print</lang> |
<lang factor>"Hello,How,Are,You,Today" "," split "." join print</lang> |
||
=={{header|Fantom}}== |
|||
A string can be split on a given character, returning a list of the intervening strings. |
|||
<lang fantom> |
|||
class Main |
|||
{ |
|||
public static Void main () |
|||
{ |
|||
str := "Hello,How,Are,You,Today" |
|||
words := str.split(',') |
|||
words.each |Str word| |
|||
{ |
|||
echo ("${word}. ") |
|||
} |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|Forth}}== |
=={{header|Forth}}== |