Tokenize a string: Difference between revisions

m
Line 760:
==={{header|BaCon}}===
BaCon includes extensive support for ''delimited strings''.
<lang bacon>string$OPTION =BASE "Hello,How,Are,You,Today"1
 
string$ = "Hello,How,Are,You,Today"
 
' Tokenize a string into an array
SPLIT string$ BY "," TO elementsarray$
 
' Print array elements with new delimiter
PRINT COIL$(i, UBOUND(array$), array$[i], ".")
 
' ReplaceOr simply replace the delimiter
PRINT DELIM$(string$, ",", ".")</lang>
 
{{out}}
<pre>prompt$ ./tokenize
Hello.How.Are.You.Today
Hello.How.Are.You.Today</pre>
 
Anonymous user