Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

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
  • +1
    Certified Lead Developer

    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
  • +1
    Certified Lead Developer

    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