Replaceing a substring with some other substring |
Post Reply |
Author | ||
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(1)
Posted: 04.Apr.2018 at 09:08 |
|
If $variable is a MERL variable, then you'll need to use it outside string quotes - otherwise you're just asking to translate that part every time to the literal string '$variable'. For simple cases, where $variable contains just alphanumeric characters, you thus have:
When that is evaluated with $variable='value', the translator is thus defined to translate 'result' into 'result_value'. If $variable can contain characters that are special to MERL translators (newline space \ / $ % - *) - then you should escape these when using it in the translator. A translator to translate escapable characters is of course pretty ugly, as the escapes need to be escaped, but here it is:
|
||
mert
Contributor Joined: 16.Mar.2016 Points: 15 |
Post Options
Thanks(0)
|
|
Dear All,
In my DSL development, I want to replace the "result" substring in a user-entered statement with the "result_"+$variable. Note here that $variable holds another user-entered data. I have tried the translator operator as below but it did not work. to '%resultTranslator' newline '$result $result_$variable' endto and used the translator as follows: :userStatement%resultTranslator;
|
||
Post Reply | |
Tweet |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |