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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:31:14+00:00 2026-06-08T19:31:14+00:00

Is it possible to do a reverse type lookup on string.format formatting strings. Say

  • 0

Is it possible to do a reverse type lookup on string.format formatting strings. Say for example I have {0:0.00} formatting string. It’s used to format a decimal. Can I pass it to a function and have it return the type in this case decimal. Or pass {0:y yy yyy yy} and have it return DateTime?

Along the lines of this (Can I check if a format specifier is valid for a given data type?) but for String.Format and I can’t pass in the type I’m looking for. I guess I can have a list of types to try against.

Any ideas?

EDIT:
I’m reading data from database that always comes in as string. I don’t know its type. I want to fit it into some other database where I do know what type it’s supposed to be. The way I know the type is because somebody has provided a string.format parameter. They don’t provide a type just the string.format parameter. So I was trying to see if I can get the type from the formatting provided. I realize this is a bad design but that’s what I’m forced into.

  • 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-08T19:31:16+00:00Added an answer on June 8, 2026 at 7:31 pm

    I have never come across anything like this, nor would it be possible in the absolute. Some format strings will work for more than one type. I am going to say there is nothing out of the box to do this.

    If you look here most of the numeric formats will work for any numeric type, int, float, double, decimal… A few will as you point out only work with dates, but it would be difficult to design a good API for describing that.

    As the commentators have said here if you post a question that more broadly reflects what you are trying to achieve you may get some better ideas.

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

Sidebar

Related Questions

Possible Duplicate: How to reverse a string in place in c using pointers? I
Possible Duplicate: Good Primer for Python Slice Notation reverse a string in Python I've
Possible Duplicate: reverse a string in Python I tried searching the python documentation for
Possible Duplicate: Can one do a for each loop in java in reverse order?
Possible Duplicate: Reverse a singly linked list reverse a linked list? I have been
Possible Duplicate: Is it possible to reverse-engineer my iPhone application? How can I get
Is it possible to reverse String in Java without using any of the temporary
Possible Duplicate: Protect .NET code from reverse engineering? we just develop a application with
Many years ago, I was admonished to, whenever possible, release resources in reverse order
Is it possible to perform a global reversed-find on NHibernate-managed objects? Specifically, I have

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.