Results 1 to 3 of 3

Thread: How to replace Tab characters?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Resolved How to replace Tab characters?

    Esteemed Forum Members and Lurkers:

    How do I remove Tab characters out of a string?

    I have strings read from a tab delimited file, and I need to trim and split them.

    The following works elsewhere, but NOT in VB.Net.


    Dim tempstr As String

    ' Simulate my string from the file - Chr(9) is a Tab
    tempstr = "336" & Chr(9) & "G1"

    Replace(tempstr, Chr(9), " ")
    MsgBox(Asc(Mid(tempstr, 1, 1))) ' 51 - 3
    MsgBox(Asc(Mid(tempstr, 2, 1))) ' 51 - 3
    MsgBox(Asc(Mid(tempstr, 3, 1))) ' 54 - 6
    MsgBox(Asc(Mid(tempstr, 4, 1))) ' 9 Tab - Should be space!
    MsgBox(Asc(Mid(tempstr, 5, 1))) ' 84 - G
    MsgBox(Asc(Mid(tempstr, 6, 1))) ' 49 - 1

    Any comments, suggestions, or assistance would be greatly appreciated.
    Last edited by Webtest; Feb 2nd, 2005 at 03:38 PM.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    Hardly surprising really!

    this line:
    Code:
    Replace(tempstr, Chr(9), " ")
    just throws the result away without using it.

    try

    Code:
    tempstr = tempstr.Replace(Chr(9), " ")
    Regards.

    Des, Professional Lurker.
    Last edited by wossname; May 5th, 2004 at 09:57 AM.
    I don't live here any more.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045
    Wossname and
    Esteemed Forum Participants and Lurkers:

    Duuuuhhhh. Thanks for the help. I'll try harder next time.




    (To Wossname: Homebrew counts!)
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

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