CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2001
    Location
    Kuala Lumpur Malaysia
    Posts
    11

    splitting text in a long line using 2 delimiters

    i'm trying to extract values from a raw data file, when the file is opened it is put into 1 long line. there are 2 delimiters, one is the "|" character and another one is the carriage return which is presented in ascii code and if i'm not mistaken its represented as chr(13) in vb code. i am using the strAryWords=Split(strValue,"|") and extracting values within each delimiters by updating the content of the array to an access table. can i use split(strvalue,"|" or chr(13))?
    really appreciate if anyone have an idea on how to do this. been stuck with this for 2 weeks.


  2. #2
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: splitting text in a long line using 2 delimiters

    You can't split using 2 delimiters, but you could change all the vbcrlf to the | (pipe) with the replace command, and then split on the | delimiter

    David Paulson


  3. #3
    Join Date
    Nov 2001
    Location
    Kuala Lumpur Malaysia
    Posts
    11

    Re: splitting text in a long line using 2 delimiters

    thanx for the info paul, so i should use vbcrlf rather that chr(13). i will try something out from this information. thank you really appreciate it.


  4. #4
    Join Date
    Nov 2001
    Location
    Kuala Lumpur Malaysia
    Posts
    11

    Re: splitting text in a long line using 2 delimiters

    it doesn't seem to work by replacing the cr character. i tried to display the original content in one text box and doing a replacing function and displaying it in another text box but nothing seems to be changed.
    FYI, the file is in ascii mode where the file resides in a solaris machine. all i'm doing is selecting the file from the mapped network drive and trying to extract it to an access table. the carriage return is represented as a simbol like a small black box.
    any tips for me?.....appreciate your time thanx.


  5. #5
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: splitting text in a long line using 2 delimiters

    It never changed because it was not a vbcrlf. I cannot tell you what character the small black box really is, but you could loop through the (in your case) the text box ,character by character and analize the asc value to find out what character it really is.

    Following is a small progect that you can incorporate int yours to help you solve this. With a command button and 2 text boxes. Contents of text1 is your file.


    option Explicit
    Dim x as Integer
    Dim t as string

    private Sub Command1_Click()
    Dim t as string
    If x < len(Text1) then
    t = mid$(Text1, x, 1)
    Text2 = t & " " & Asc(t)
    x = x + 1
    End If
    End Sub


    private Sub Form_Load()
    x = 1
    End Sub






    David Paulson


  6. #6
    Join Date
    Nov 2001
    Location
    Kuala Lumpur Malaysia
    Posts
    11

    Re: splitting text in a long line using 2 delimiters

    thanx man it was chr(10)......thanx for boosting me up...now on i go.....appreciate it...


  7. #7
    Join Date
    Sep 2001
    Location
    Montreal Canada
    Posts
    1,080

    Re: splitting text in a long line using 2 delimiters

    Unix computers use character 10 for Line feeds.

    Windows computers use Character 10 and character 13
    not 1 or the other.. Both..

    if I write text in unix it would be

    blablablabla10 as 10 would be the line feed
    in windows it would be
    blablablabla1013 as 1013 would be the line feed 10 is line feed character and 13 is chariot return..



    got it ?


    Nicolas Bohemier
    ______________

    Un sourire ne coûte rien, mais il rapporte beaucoup; il enrichit celui qui le reçoit sans appauvrir celui qui le donne.

    Frank Irving Fletcher

    Nicolas Bohemier

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

Featured