suve

awful: function: str-explode

Available since rev.40 (v.0.5.4).

Declaration

array :str-explode ( string $TEXT , string $SEPARATOR )
array :explode-str ( string $TEXT , string $SEPARATOR )

Summary

Takes a piece of $TEXT containing multiple records separated by $SEPARATOR and returns the records as an array.

When omitted, $SEPARATOR defaults to the comma character (,).

Example

# :str-explode
:set &txt s''
:writeln s'Write some fruits, separated by spaces: '
:readln &txt
 
:set &fru :str-explode $txt sx x
:writeln s'You specified ' (:arr-count $fru) s' types of fruit.'
 
:set $idx i0
!while :lt $idx :arr-count $fru
   :writeln s'Fruit ' (:add $idx i1) s': ' $fru[$idx]
   :add &idx i1
!done

wikipage modified on 2014/0916/1608