Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » extracting a string from a string
extracting a string from a string [message #1763463] Tue, 16 May 2017 12:10 Go to next message
im hello world is currently offline im hello worldFriend
Messages: 44
Registered: February 2017
Member
Hi everybody,
can anyone help me please how can i verify with ATL that for example a string "'task1_ready" contains a string "_ready".
In fact, i have many strings, for example, task1_ready, task1_working, task1_finish, and i need to get only the strings that contains "_ready".

Thanks in advance.
Regards

Re: extracting a string from a string [message #1763494 is a reply to message #1763463] Tue, 16 May 2017 17:28 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

Regular ATL only supports the OCL 2.0 string operations (https://wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Language#String_data_type_operations). EMFTVM allows you to use Java String methods on top of that, such as "contains".

Cheers,
Dennis
Re: extracting a string from a string [message #1763718 is a reply to message #1763494] Thu, 18 May 2017 23:30 Go to previous messageGo to next message
im hello world is currently offline im hello worldFriend
Messages: 44
Registered: February 2017
Member
Hi Dennis,
Thank you for replying.
i installed EMFTV to try the java String method 'contains', but i don't find the way to use it in the tutorial available on internet. so, as i'm a starter with EMFTV, Can you please give me an idea how to call contains in an ATL code using EMFTV?
Can you please provide me with tutorials to start with EMFTV because i don't manage to find it on internet.
Thank you in advance
Re: extracting a string from a string [message #1763802 is a reply to message #1763718] Fri, 19 May 2017 21:06 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

There's only the EMFTVM wiki page, which describes what is different from regular ATL. Once you've got your transformation running in EMFTVM, you can use "contains" as follows:
rule Test {
  from s : MM!S (s.taskName.contains('_ready'))
  ...
}


Cheers,
Dennis
Previous Topic:startsWith(s : String)
Next Topic:error: java.lang.String does not have properties
Goto Forum:
  


Current Time: Tue Apr 16 14:17:25 GMT 2024

Powered by FUDForum. Page generated in 0.91436 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top