enterprise-architectmda

String processing in Enterprise Architect CDT


Is it possible to somehow match and parse the string within transformation template (CDT) ?

I have a string: Dictionary and I would need: 1) detect tha string starts with Dictionary keyword 2)extract second parameter -> Shift


Solution

  • Sorted with following snippet - it is not most elegant way but works given the constraints

    $dic=%FIND(opReturnType,"Dictionary")%
    
    %If $dic!="-1"%
    $note="TODO://Replace: with java.util.Map "
    $note+=%opReturnType%
    $t=%opReturnType%
    $pos=%FIND($t,",")%
    $dict=%LEFT($t,$pos)%
    $ty=%REPLACE($t,$dict,"")%
    $typ=%TRIM_LEFT($ty,",")%
    $typp=%TRIM_RIGHT($typ,">")%
    $type=%TRIM($typp)%
    $lowerBound="0"
    $upperBound="*"
    %endIf%