Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. datatype check

datatype check

Scheduled Pinned Locked Moved C#
questioncsharptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Hi, Guys I need to get data type for the streams that I read into the memroy. Assumption is that we don't know anything about file.(we do know deliminator, which in this case is '#') for example input files is as follows name#money#loanNumber Joe#10000#L01 Amy#2000#L05 Tom#12000#L11 As you see, column name and loadNumber is type of string, and money is integer. However, how do I decide in my c# program? should I make compare set of {'0', ..., '9'} and compare one by one for all the characters? Or is there any other way to decide these data type. Thanks guys!

    A 1 Reply Last reply
    0
    • A Anonymous

      Hi, Guys I need to get data type for the streams that I read into the memroy. Assumption is that we don't know anything about file.(we do know deliminator, which in this case is '#') for example input files is as follows name#money#loanNumber Joe#10000#L01 Amy#2000#L05 Tom#12000#L11 As you see, column name and loadNumber is type of string, and money is integer. However, how do I decide in my c# program? should I make compare set of {'0', ..., '9'} and compare one by one for all the characters? Or is there any other way to decide these data type. Thanks guys!

      A Offline
      A Offline
      Andy Wieberneit
      wrote on last edited by
      #2

      - Read one line - Parse that line for '#' - Split the line into its substrings - Analyze any substring, using String.IndexOfAny( "ABCDEFG..." ) - If index found, it is a string; else, it is an integer

      A 1 Reply Last reply
      0
      • A Andy Wieberneit

        - Read one line - Parse that line for '#' - Split the line into its substrings - Analyze any substring, using String.IndexOfAny( "ABCDEFG..." ) - If index found, it is a string; else, it is an integer

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Thank you!! you saved me! ;)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups