Customer Portal

find matching characters in 2 strings

Comments 1

  • Avatar
    dpavlis
    0
    Comment actions Permalink
    Hi,
    the first can be done somehow like this in CTL:

    string str1;
    string str2;
    string target;

    for(integer i=0;i<lenght(str1);i++){
    string letter=charAt(str1,i);
    if (contains(str2,letter) target=target+letter;
    }


    Basically I go through individual letters/characters of str1 and check whether they are included somewhere in str2. If yes then I add that letter to the target (result) string.

    As for the other case - not sure what should be the logic. But you can use this example to deduce that piece of code you might need.

Please sign in to leave a comment.