I want to change userId to ****
. I want to count length of a userId and change the string to that many asterisks. I also want to take the account number and replace all characters except the last 4 XXXX
.
How do I do these things?
I want to change userId to ****
. I want to count length of a userId and change the string to that many asterisks. I also want to take the account number and replace all characters except the last 4 XXXX
.
How do I do these things?
Your first one - assuming that your userId is only contains characters A-Z
System.Text.RegularExpressions.Regex.Replace("userID", "[A-z]", "*")
Assuming accountNumber and userid are strings
Dim userid As String = "1234"
Dim accountNumber As String = "1234-5678-9876"
userid = New String("*"c, userid.Length)
accountNumber = New String("X"c, accountNumber.Length - 4) &
Right(accountNumber, 4)
MsgBox(userid + vbCrLf + accountNumber)