Terrence Brannon <[EMAIL PROTECTED]> wrote:

> Is it possible to specify what the verb ;: will use to split the 
> string?

Monadic ;: splits strings according to the specific rhematic rules
of the J language, which is sometimes suitable as a quick hack, as in
   colors =: ;:'red green blue'
but is generally not suitable for user-generrated data. You can use
dyadic ;: to split a string according to any other criteria that a finite
state machine can recognize (such as comma-delimited strings, ignoring
commas within strings) but this is probably overkill for most applications.

Much more suitable is ;. Typically, you can use <;._1 (which requires
the delimiter to be at the front of the string), or <;._2 (which requires
it at the end). You can also create a simple dyadic verb that takes two
parameters - an arbitrary delimiter, and a delimited string which does
not need a delimiter at either end:
   '/' <;._1@, 'this/is/a/string'
+----+--+-+------+
|this|is|a|string|
+----+--+-+------+

-- Mark D. Niemiec <[EMAIL PROTECTED]>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to