Results 1 to 3 of 3

Thread: Soring Text

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    Soring Text

    This is what I am doing, I am writing a compiler. To input the Tokens from the sorce code file i have to read the file line by line. I have to sort the text accoring to Alpha (string of nothing but chars a-z and A-Z), Numeric (string of nothing but 0-9), alpha Numeric (String starting with a char a-z or A-Z and also contains numbers 0-9), other (String other then alpha, numeric, or alpha numeric), finaly there is a quote (string enclosed by either " (double quotes) or ' (Single quotes))

    I have asked this question before and most people say use the split function however it will not work with the quotes because the split function just looks for spaces almost like the cin in c++ it stops at white space. But with a quote it can include white space for example "Hello my name is bob" the split function would read that as "Hello then my then name then is then bob" see it will not work. So does any one have an idea around that problem, with out writing my own split function. I have written my own many times using loops(did't work too well it took about 10 minuets to sort 1000 lines of code), and also one using recursion (did't work too well either it caused a stack over flow after about 500 lines of code) . I have thought about writing the sort function in c++ using assembly also, but linking that with vb is not an easy task. Does any one have any ideas. Thanks in advance.

  2. #2
    Junior Member RvA's Avatar
    Join Date
    Oct 2002
    Location
    USA
    Posts
    19
    Hello,

    There was an artical in VBPJ awhile ago about doing just this. I will have to take a look though the back issuse and see if I can find it. You might also goto VBPJ's web site an look there to see if you can find anything.
    Best,

    Roger

    VB6.0 SR5 & VB.Net Pro
    -----------------------------------------------
    Do or do not, there is no try!

  3. #3
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    Sounds like a job for Regular Expressions?
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width