Home » Modeling » TMF (Xtext) » Xtend, rich strings and SEPARATOR option
Xtend, rich strings and SEPARATOR option [message #876315] |
Thu, 24 May 2012 11:05 |
Aran A Messages: 30 Registered: January 2011 |
Member |
|
|
Hello,
In a previous post I have seen this code with rich strings
toString(Entity e) '''
«e.name»
«FOR member: e.members BEFORE "(" SEPARATOR "," AFTER ")"»
«member.toString»
«ENDFOR»
'''
The result will be the members separated by commas, in parentheses. If there
are no members, there won't be parentheses.
OK, but how can I do if I have a conditional inside the FOR?, as in the example:
toString(Entity e) '''
«e.name»
«FOR member: e.members BEFORE "(" SEPARATOR "," AFTER ")"»
«IF (a condition...)»«member.toString»«ENDIF»
«ENDFOR»
'''
Then, the result could be something like: m1, , , , m5, m6, m7, , , , , , m13,
How can I do if I want a result will be m1, m5, m6, m7, m3 ? Do I have to work it by hand?
Thanks in advance,
Aran
|
|
| |
Goto Forum:
Current Time: Fri Apr 26 08:34:38 GMT 2024
Powered by FUDForum. Page generated in 0.03050 seconds
|