Friday, September 7, 2012

ReplaceWith X of except last 4 digits of account number in asp.net


public string ReplaceWithX(string ReplaceFor)
    {
        string strReplace = string.Empty;
        string strlastdigits = string.Empty;
        int LastDigits = ReplaceFor.Length - 4;
        strReplace = ReplaceFor.Substring(0, ReplaceFor.Length - 4);
        
        for (int i = 0; i < strReplace.Length; i++)
        {
            strlastdigits += strReplace[i].ToString().Replace(strReplace[i].ToString(), "x").ToString();
        }
        strlastdigits += ReplaceFor.Substring(LastDigits);
        return strlastdigits;
    }

This method is useful for ReplaceWithX of account number except last 4 digits...

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software