How to divide string by string tokanizer class in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neehakale
    New Member
    • Aug 2007
    • 46

    How to divide string by string tokanizer class in c#

    pls tel me...
    I have to store data to heap file from a simple file.my file contain numeric data and string data...i have to divide tha data into numric and string. i.e.


    my file contain data
    1 meena
    2 Sheena
    3 teena


    as per heap class syntax i have to brk the data into key and value.
    keys are:1,2,3
    values are:meena,shenn a,tenna


    pls help me to solve this prob
    Last edited by neehakale; Aug 17 '07, 10:53 AM. Reason: I want this in c#
  • HTB
    New Member
    • Aug 2007
    • 13

    #2
    Try this,

    Hashtable table = new Hashtable();

    string input;

    while( ( input = reader.ReadLine () ) != null)
    {
    string[] tokens = input.Split(' ');

    table[ tokens[0] ] = tokens[1];
    }

    Comment

    Working...