String character modify

Example 1 :

Input : 123456789
Output : 12345****

Example 2 :

Input : 1234567890
Output : 123456****

I want last four char replace to *

Hi @AJITH_SK

Input: "123456789"
Message Box: If(inputString.Length >= 4, inputString.Substring(0, inputString.Length - 4) & "****", inputString)


Hope it helps!!

1 Like

Hi @AJITH_SK

if (inputString.Length >= 4)

    inputString = inputString.Substring(0, inputString.Length - 4) + "****";

2 Likes

@AJITH_SK

If you find solution,Please do mark it as solution

Hi @AJITH_SK

If you find solution for your query please mark it as solution to close the loop.

Happy Automation

Regards

Hi @AJITH_SK

Use below expression in Assign Activity

IF(INPUT.Length >= 4, INPUT.Substring(0, INPUT.Length - 4) + “****”, INPUT)

Hope it will helps you :slight_smile:
Chees!!

Hi,

FYI, the following expression works (even if input length is less than 4.)

System.Text.RegularExpressions.Regex.Replace(yourString,".{1,4}$",Function(m) New String("*"c, m.Length))

Regards,