|
-
May 5th, 2004, 09:23 AM
#1
Thread Starter
Frenzied Member
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
-
May 5th, 2004, 09:51 AM
#2
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.
-
May 5th, 2004, 10:06 AM
#3
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|