string s = ReplaceAt(txtCreditCardNumber.Text, 12, 4, '*');
public string ReplaceAt(string input, int index, int count, char newChar)
{
if (input == null)
{
throw new ArgumentNullException("input");
}
char[] chars = input.ToCharArray();
for (int i = 0; i < count; i++)
{
chars[index] = newChar;
index++;
}
return new string(chars);
}
No comments:
Post a Comment