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 322855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:58:38+00:00 2026-05-12T08:58:38+00:00

We have lots of strings in our resource files that contains format .e.g {0}

  • 0

We have lots of strings in our resource files that contains format .e.g

“{0} has moved to {1}”

These strings are passed to String.Format() by the applications, sometimes the translators mess up the “formatting markers” Therefore I wish to find/write a tool that checks that all strings in the resource file has a valid format.

I know for each key the numbers of args that are passed to String.Format so that can feed into the validations as well.

So apart from checking that the “{“ match the “}” is there a easy way to find most errors in the format strings?

(I am using .NET, this checking will of course be done as part of the build process)

  • 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-05-12T08:58:38+00:00Added an answer on May 12, 2026 at 8:58 am

    I have come up with a simple solution that gives a reasonable result, I know the number of argument to the format statement but not the type of the arguments. However most arguments are strings.

    So

    if (numberOfArguments == 3)
    {
      try
      {
        String.Format(theTranslatorString, "", "", "")
      }
      catch
      {
         // tell the translator there is a problem with the string format
      }
    }
    

    Of course this would be written without an “if” for each number of arguments in real life.

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

Sidebar

Related Questions

we will be processing our .resx files for translation. Since these files have lots
in a rails project i have to deal with lots of strings, that are
I have lots of global read only strings (around 100) that I am using
We have some auto-generated resource files in our project in Visual Studio 2008, with
I have lots of source code files. I have lots of hard coded string.
I have a JSon response that contains lots of \u003c or \u00252 or other
I have lots of files in a particular Directory. In a certain PHP page
I have lots of bson files in the following path: c:/mongodb/bin/dump/Sid If I run
I am trying to connect to our exchange 2007 server. I have placed lots
We have a mid-size SQL Server based application that has no indexes defined. Not

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.