How to mask credit card Number?

Hello All,

I need to mask all the credit card numbers with “XXXXXX” In between the credit card number.

For example:

If the credit Card number is 1234567891234567 I need to mask the credit card as 123456XXXXXX4567.

How Can I replace 6 characters in between the credit card?

Any leads or help is much appreciated.


  1. Let’s say

varCreditCardNumber = “1234567891234567”

  1. And then try below expression.

maskedCreditCardNumber = varCreditCardNumber.Replace(varCreditCardNumber.SubString(6,6),"XXXXXX")

Hi @Sirimalla_Karthik_Chandra,

Either use the method suggested by @lakshman
Use the Encrypt/Decrypt string activities from


This way the credit card number will be encrypted in queue (via Dispatcher) and decrypted by the robot in the performer.


1 Like

Hi @lakshman, Thank you so much for the help.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.