JESS: Strinf to List

View: New views
3 Messages — Rating Filter:   Alert me  

JESS: Strinf to List

by Uiratan Cavalcante :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I have a string in the variable ?modelname. Ex: "Agent of System".

I need to get the first element (Agent), so i tried: (bind ?ag (first$ (create$ ?modelname)))

But it returns me "Agent of System". Any help?

Best regards,

--
Uiratan Cavalcante              +55 (98) 8138-9212
TI/TRT-16-MA    (Manhã)     +55 (98) 2109-9430    http://www.trt16.gov.br
GESEC/UFMA   (Tarde)      +55 (98) 2109-8297    http://gesec.deinf.ufma.br
São Luís - MA - Brazil

Re: JESS: Strinf to List

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That's what "explode$" does -- break a string into tokens. So...

  (bind ?ag (first$ (explode$ ?modelname)))


On Sep 30, 2009, at 2:43 PM, Uiratan Cavalcante wrote:

> Hi all,
>
> I have a string in the variable ?modelname. Ex: "Agent of System".
>
> I need to get the first element (Agent), so i tried: (bind ?ag (first
> $ (create$ ?modelname)))
>
> But it returns me "Agent of System". Any help?
>
> Best regards,
>
> --
> Uiratan Cavalcante              +55 (98) 8138-9212
> TI/TRT-16-MA    (Manhã)     +55 (98) 2109-9430    http://www.trt16.gov.br
> GESEC/UFMA   (Tarde)      +55 (98) 2109-8297    http://gesec.deinf.ufma.br
> São Luís - MA - Brazil

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Strinf to List

by Uiratan Cavalcante :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Simple, hum?

Thanks!

2009/9/30 Ernest Friedman-Hill <ejfried@...>
That's what "explode$" does -- break a string into tokens. So...

 (bind ?ag (first$ (explode$ ?modelname)))





--
Uiratan Cavalcante              +55 (98) 8138-9212
TI/TRT-16-MA    (Manhã)     +55 (98) 2109-9430    http://www.trt16.gov.br
GESEC/UFMA   (Tarde)      +55 (98) 2109-8297    http://gesec.deinf.ufma.br
São Luís - MA - Brazil