I have a card number as a string, for example:
string ClsCommon.str_CardNumbe r = \"3456123434561234\";
The length of this card number can
I would do something like this (pseudo C# - take as rough idea to build upon).
Untested code ahead...
string MaskDigits(string input)
{
//take first 6 characters
string firstPart = input.Substring(0, 6);
//take last 4 characters
int len = input.Length;
string lastPart = input.Substring(len - 4, 4);
//take the middle part (XXXXXXXXX)
int middlePartLenght = input.Substring(6, len - 4).Count();
string middlePart = new String('X', 5);
return firstPart + middlePart + lastPart;
}