Another aspect of my problem...
This is my simplified setting (just as example!):
The text file Text.txt containing the string 'abcdefgh' was saved as unicode.
A string is generated by reading from the binary file Text.txt (st = Input(100, #1)). The string looks like this: 'a.b.c.d.e.f.g.h', where '.' represents the nul character (NUL).
Now I would like to search in this binary string, e.g. for 'fg'. This means that I have to search for the character sequence f, NUL, g.
How this search can be done with instr?
Searching in binary strings with the nul character
-
- Posts: 117
- Joined: Jun 21, 2018 11:14
Re: Searching in binary strings with the nul character
Code: Select all
Dim As String s = "a" & Chr(0) & "b" & Chr(0) & "c" & Chr(0) & "d" & Chr(0) & "e" & Chr(0) & "f" & Chr(0) & "g" & Chr(0) & "h"
Dim As String subs = "f" & Chr(0) & "g"
Print Instr(s, subs)
-
- Posts: 117
- Joined: Jun 21, 2018 11:14
Re: Searching in binary strings with the nul character
Fast, precise, targeted, not digressive, helpful!
You are a schatz, fxm!
You are a schatz, fxm!