How to replace special character in string

 I have the string with multiple repeated special characters which needs to be replaced with another character.

 

Eg: s'd'g' has to be replaced with s@d@g@.

 

Please suggest.

  Discussion posts and replies are publicly visible

Parents
  • Since nobody's said so already, I suggest you check out the function substitute().

    j/k

     

    Seriously though, I would like to offer the following expression rule which you can use to do multiple simultaneous substitutions.  It accepts 2 equal-length arrays, ri!originalValues which will be replaced by the members of ri!replacementValues.  Original text is ri!inputText.

    if(
      count(ri!originalValues) <> count(ri!replacementValues),
      ri!inputText,
      reduce(
        fn!substitute,
        ri!inputText,
        merge( ri!originalValues, ri!replacementValues )
      )
    )
Reply
  • Since nobody's said so already, I suggest you check out the function substitute().

    j/k

     

    Seriously though, I would like to offer the following expression rule which you can use to do multiple simultaneous substitutions.  It accepts 2 equal-length arrays, ri!originalValues which will be replaced by the members of ri!replacementValues.  Original text is ri!inputText.

    if(
      count(ri!originalValues) <> count(ri!replacementValues),
      ri!inputText,
      reduce(
        fn!substitute,
        ri!inputText,
        merge( ri!originalValues, ri!replacementValues )
      )
    )
Children
No Data