|
-
Jan 7th, 2006, 05:18 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Remove Delimiter Question
Hey guys got a question on removing a delimiter on a random sized string. The string is a persons name, their respective hex numbers, with the number 0 seperating each hex value. Such as:
5706906306306106106E
Would equal Wiccaan, with 0's seperating each hex combo.
I need to remove the 0, or change it with a " " (space) instead of having the 0's there. I ask this cause I have a file of names in hex with this delemiter and I need to convert it from the hex to regular letters.
I can make the ASCII function to convert the hex to ascii, I just cant figure out how to start a function to remove the 0's because hex uses 0's...
Thanks for the help in advance.
If my post was helpful please rate it 
-
Jan 7th, 2006, 05:25 PM
#2
Re: Remove Delimiter Question
Maybe with Replace?
VB Code:
MyString = Replace (MyString, "0", " ")
Or you could use directly Split(MyString, "0"), that will return an array with Hex values (in string format).
Last edited by jcis; Jan 7th, 2006 at 05:29 PM.
-
Jan 7th, 2006, 05:32 PM
#3
Fanatic Member
Re: Remove Delimiter Question
jcis: That method would not work due to the fact that some hex values can start with a zero. For example:
01 0A 0B, and if you string those together with a delimiter of zero you get
0100A00B
wiccaan: Can you just change the delimiter to something easy to get out such as ";"?
"X-mas is 24.Desember you English morons.." - NoteMe
-
Jan 7th, 2006, 05:34 PM
#4
Thread Starter
Hyperactive Member
Re: Remove Delimiter Question
 Originally Posted by jcis
Maybe with Replace?
VB Code:
MyString = Replace (MyString, "0", " ")
Or you could use directly Split(MyString, "0"), that will return an array with Hex values (in string format).
For some reason I went brain dead on that and keep figuring that the letters had 0's in them as well. Sorry about my mistake. Thanks.
 Originally Posted by dsheller
jcis: That method would not work due to the fact that some hex values can start with a zero. For example:
01 0A 0B, and if you string those together with a delimiter of zero you get
0100A00B
wiccaan: Can you just change the delimiter to something easy to get out such as ";"?
Cant, its not my file, Im just converting it to the actuall names. Like the file is updated probably weekly almost from someone else. So Im just going with what he is using himself.
If my post was helpful please rate it 
-
Jan 7th, 2006, 05:35 PM
#5
Re: Remove Delimiter Question
 Originally Posted by dsheller
jcis: That method would not work due to the fact that some hex values can start with a zero. For example:
01 0A 0B, and if you string those together with a delimiter of zero you get
0100A00B
wiccaan: Can you just change the delimiter to something easy to get out such as ";"?
Ok, but no program will be able to guess what kind of "0" it is (if delimiter or part of a Hex), so, What about using another character as delimiter?
-
Jan 7th, 2006, 05:38 PM
#6
Fanatic Member
Re: Remove Delimiter Question
VB Code:
Private Sub Form_Load()
Dim hx As String
hx = "5706906306306106106E"
Do Until Len(hx) = 0
MsgBox ReadTwo(hx)
hx = ChopTwo(hx)
If Len(hx) >= 1 Then
hx = ChopDelim(hx)
End If
Loop
End Sub
Private Function ReadTwo(strString As String) As String
ReadTwo = Left(strString, 2)
End Function
Private Function ChopTwo(strString As String) As String
ChopTwo = Right(strString, Len(strString) - 2)
End Function
Private Function ChopDelim(strString As String) As String
ChopDelim = Right(strString, Len(strString) - 1)
End Function
Alright, well as long as each hex char is always two digits that should work.
"X-mas is 24.Desember you English morons.." - NoteMe
-
Jan 7th, 2006, 05:38 PM
#7
Re: Remove Delimiter Question
because the hex value will be no more than 2 characters then we can do a for loop with a step of 3 then convert within the loop
VB Code:
Dim str1 As String, i As Long, str2 As String
str1 = "5706906306306106106E"
For i = 1 To Len(str1) Step 3
str2 = str2 & Chr(CLng("&H" & Mid$(str1, i, 2)))
Next i
MsgBox str2
casey.
-
Jan 7th, 2006, 05:42 PM
#8
Fanatic Member
Re: Remove Delimiter Question
I like vbasicgirls way of doing it better than mine, try that one.
"X-mas is 24.Desember you English morons.." - NoteMe
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
|