[EMAIL PROTECTED] wrote:

> I think Christian Lasarczyk wrote:
> >
> > Jess> (call "test" replace "e" "t")
> > "ttst"
> >
> > works fine, but how to represent an empty String to emove all "e" ?
> >
> > (call "test" replace "e" "")
> > Jess reported an error in routine call
> >       while executing (call "test" replace "e" "").
> >   Message: No overloading of method 'replace' in class java.lang.String
> > I can call with these arguments: (call "test" replace "e" "").
> > ....
>
> Well, if you can show me the working Java code which does this, I'll
> show you how to implement it in Jess! :)
>
> The method you're calling, String.replace(String, char, char), can't
> change the length of the argument string. When I've needed to do what
> you want to do in Java, I've always used a StringBuffer and a for-loop
> to accumulate the characters I want to keep (does anybody know a
> better way?) Although you -could- probably code this up in Jess, it'd
> be simpler to write is as a Userfunction in Java.
>
>

It's easy in Jess too - not sure how efficient:

(bind ?r "")
(foreach ?e (explode$ (call "test" replace "e" " ")) (bind ?r (str-cat ?r
?e)))


> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to