|
-
Aug 31st, 2000, 11:43 PM
#1
Thread Starter
Member
Hi
I am trying to write a function that works with files that only have a ".txt" extension.
code:
str1 = '(Whatever the filename is)
str2 = "*.txt"
intCompare1 = str1 Like str2
if intCompare1 = "-1" then
msgbox("Contains txt file")
else
msgbox("Does not contain txt file")
end if
Question: How do I include in the comparrison, variations of .txt? (eg. *.txt, *.TXT, *.Txt etc...)
Thanks
Gregg
-
Aug 31st, 2000, 11:58 PM
#2
Why not just convert it to lowercase? Whether it's uppercase or lowercase, it's still the same file.
Code:
str1 = LCase$("C:\FILE.TXT")
str2 = ".txt"
If Instr(str1, str2) Then
Msgbox ("Contains txt file")
Else
Msgbox ("Does not contain txt file")
End If
-
Aug 31st, 2000, 11:58 PM
#3
Hyperactive Member
Convert both to lower case and the test will always be true
Code:
intCompare1 = lcase(str1) like lcase(str2)
-
Sep 1st, 2000, 12:04 AM
#4
Thread Starter
Member
Thanks for your help guys.
Much appreciated...
Gregg
-
Sep 1st, 2000, 12:05 AM
#5
Gen-X, two great minds think alike .
-
Sep 1st, 2000, 12:40 AM
#6
transcendental analytic
YOu could just put option compare text, in the declarations instead of using lcase$
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|