Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9217133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:34:27+00:00 2026-06-18T02:34:27+00:00

We have a requirement to display bank routing/account data that is masked with asterisks,

  • 0

We have a requirement to display bank routing/account data that is masked with asterisks, except for the last 4 numbers. It seemed simple enough until I found this in unit testing:

string.Format("{0:****1234}",61101234)
is properly displayed as: "****1234"

but

string.Format("{0:****0052}",16000052)
is incorrectly displayed (due to the zeros??): "****1600005252""

If you use the following in C# it works correctly, but I am unable to use this because DevExpress automatically wraps it with “{0: … }” when you set the displayformat without the curly brackets:

string.Format("****0052",16000052)

Can anyone think of a way to get this format to work properly inside curly brackets (with the full 8 digit number passed in)?

UPDATE: The string.format above is only a way of testing the problem I am trying to solve. It is not the finished code. I have to pass to DevExpress a string format inside braces in order for the routing number to be formatted correctly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:34:28+00:00Added an answer on June 18, 2026 at 2:34 am

    I think you are looking for something like this:

    string.Format("{0:****0000}", 16000052);
    

    But I have not seen that with the * inline like that. Without knowing better I probably would have done:

    string.Format("{0}{1}", "****", str.Substring(str.Length-4, 4);
    

    Or even dropping the format call if I knew the length.

    These approaches are worthwhile to look through: Mask out part first 12 characters of string with *?

    As you are alluding to in the comments, this should also work:

    string.Format("{0:****####}", 16000052);
    

    The difference is using the 0’s will display a zero if no digit is present, # will not. Should be moot in your situation.

    If for some reason you want to print the literal zeros, use this:

    string.Format("{0:****\0\052}", 16000052);
    

    But note that this is not doing anything with your input at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP ListView, and have a very simple requirement to display numbers
I have a requirement where i need to display Streaming Data like Bid ,
I have a requirement to display a particular colour representation dependant upon data. At
I have a requirement to display a particular page in a website that is
I have a requirement to display the database name on the screen that is
I have a client that has a requirement to display PDFs directly within a
I have a requirement to display dynamically generated word document on the server in
currently I have a requirement to display related items in a multi level grid.
I have an MVC3 C#.Net web app. I have a requirement to display a
I have a requirement wherein I need to display on a User form, a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.