Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Operators with String : str1 contains str2 ?
Operators with String : str1 contains str2 ? [message #714319] Wed, 10 August 2011 06:06 Go to next message
AmenieV  is currently offline AmenieV
Messages: 13
Registered: June 2011
Junior Member
Hi,

I have too strings str1 et str2 and I want to know if str1 contains str2 !
How can I write this instruction with OCL?

What I saw in the different courses of OCL,there are just :
size()
concat(String)
toUpper()
toLower()
substring(Entier, Entier) as operators for String..

I tried with 'endswith' in interactiveOCL and ,exactly,it displays me an error.
So What should I do?

Thankx,
Regards
(no subject) [message #714487 is a reply to message #714319] Wed, 10 August 2011 12:02 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

Try String::indexOf(String)

Regards

Ed Willink

On 10/08/2011 11:06, AmenieV wrote:
> Hi,
>
> I have too strings str1 et str2 and I want to know if str1 contains
> str2 ! How can I write this instruction with OCL?
>
> What I saw in the different courses of OCL,there are just :
> size() concat(String) toUpper() toLower()
> substring(Entier, Entier) as operators for String..
>
> I tried with 'endswith' in interactiveOCL and ,exactly,it displays me
> an error. So What should I do?
>
> Thankx,
> Regards
Re: (no subject) [message #714738 is a reply to message #714487] Thu, 11 August 2011 08:13 Go to previous message
AmenieV  is currently offline AmenieV
Messages: 13
Registered: June 2011
Junior Member
Thanks a lot Ed ..
Previous Topic:index in a collection
Next Topic:Definion of variables inOclInEcore
Goto Forum:
  


Current Time: Thu Jul 24 21:46:07 EDT 2014

Powered by FUDForum. Page generated in 0.01742 seconds