|
Re: ocl contains operations over strings [message #25596 is a reply to message #25556] |
Tue, 29 May 2007 15:32 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Angel,
Nope. But, you can do this:
Sequence{1..s.size()}->exists(i | s.substring(i, i) = ' ')
to determine whether a string s contains spaces.
You can even use OCL to define this as an additional operation in your
environment:
context String
def: hasSpace : boolean =
Sequence{1..self.size()}->exists(i | self.substring(i, i) = ' ')
HTH,
Christian
Angel Luis Calvo Ortega wrote:
> Hello!
> Is there any operation in OCL which returns if a string contains spaces?
>
> Thanks.
|
|
|
Re: ocl contains operations over strings [message #25801 is a reply to message #25596] |
Tue, 29 May 2007 17:16 |
Eclipse User |
|
|
|
Originally posted by: angel.calvo.centic.es
Thanks a lot Christian!
It's worked perferctly.
Christian W. Damus escribió:
> Hi, Angel,
>
> Nope. But, you can do this:
>
> Sequence{1..s.size()}->exists(i | s.substring(i, i) = ' ')
>
> to determine whether a string s contains spaces.
>
> You can even use OCL to define this as an additional operation in your
> environment:
>
> context String
> def: hasSpace : boolean =
> Sequence{1..self.size()}->exists(i | self.substring(i, i) = ' ')
>
> HTH,
>
> Christian
>
>
> Angel Luis Calvo Ortega wrote:
>
>> Hello!
>> Is there any operation in OCL which returns if a string contains spaces?
>>
>> Thanks.
>
|
|
|
Re: ocl contains operations over strings [message #923023 is a reply to message #25556] |
Tue, 25 September 2012 14:44 |
|
Hi friends,
leveraging the post I would like to know if have way to know if a string has a substring.
For example to know if string: 'return 123+996*oldVar' has substring 'return'
If you can help me, I thank you.
I already tried formulate the expression but I had no success.
Thank you for the help and I'm sorry about the english.
Pablo.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04893 seconds