How to check if a string has balanced [] {} ()?

Any pair by itself is easy enough, but I want to check all three balance 
together, e.g.

   ...[(])...

would fail. Assume there are no character strings.

Ideally, I'd like a result of

   0 = balanced
   1 = balanced so far, but some closing delimiters to come
   2 = unbalanced (and broken)


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

Reply via email to