-
Oct 11th, 2000, 04:48 AM
#1
Thread Starter
Frenzied Member
How can I compare 2 strings with a fixed length?
string #1 is "bla bla bla"
string #2 is "bla bla bla\bla"
^.........^ <- needs to be checked and should be ok.
string #1 is "bla bla blaa"
string #2 is "bla bla bla\bla"
^..........^ <- should be wrong.. duh
I need to check if string 2 is indentical to string 1 with the length of string 1.
(does this make sense?)
Thanks in advance.
-
Oct 11th, 2000, 05:33 AM
#2
Member
How about:
Dim s1 As String
Dim s2 As String
Dim r As Boolean
s1 = "bla bla bla"
s2 = "bla bla bla\bla"
r = (StrComp(Left$(s2, Len(s1)), s1) = 0)
Debug.Print r
s1 = "bla bla blaa"
s2 = "bla bla bla\bla"
r = (StrComp(Left$(s2, Len(s2)), s1) = 0)
Debug.Print r
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
|