Need to handle cuts which have the beginning string
but do not have the ending string:

delete=: 4 : 0
 's e'=. y
 b=. s E. x
 k=. b i. 1
 bx=. b <;.1 x
 c=. e&(+./@E.)&> bx
 (k{.x) , ; bx (I.c)}~ ((#e)&+@(e&(E.i.1:)) }. ])&.> c#bx
)

   'has a begin but has no END' delete 'begin';'end'
has a begin but has no END



----- Original Message -----
From: R&S HUI <[EMAIL PROTECTED]>
Date: Sunday, July 9, 2006 8:44 am
Subject: Re: [Jprogramming] String manipulation

> delete=: 4 : 0
> 's e'=. y
> b=. s E. x
> k=. b i. 1
> (k{.x) , ; (((#e) + e&(E.i.1:)) }. ])&.> (#s) }.&.> b <;.1 x
> )
> 
>   x=: 100 $ 'foo upon thee ignorant ingrates '
>   x delete 'upon';'in'
> foo grates foo grates foo grates foo 
>   x delete 'oo';'ee'
> f ignorant ingrates f ignorant ingrates f ignorant ingrates f



> ----- Original Message -----
> From: JC Coez <[EMAIL PROTECTED]>
> Date: Sunday, July 9, 2006 8:21 am
> Subject: [Jprogramming] String manipulation
> 
> I want to eliminate from a string all substrings delimited by starting and 
> (different) ending delimiters. Any help is appreciated.


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

Reply via email to