Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
jim i have a question on this and the option compare text
if i run the following code with option compare text under option explicit, i get "the same" if i remove option compare text, i get "different" why the difference? Sub test() str1 = "Gary" str2 = "gary" If str1 Like str2 Then MsgBox "the same" Else MsgBox "different" End If End Sub -- Gary "Jim Cone" wrote in message ... If I were doing it I would use the "Like" operator... If string1 Like string2 Then This requires the "Option Compare Text" statement at the top of the module. I doubt if there is any difference in the time required for Ucase vs. Lcase. If time is an issue, then run each code version and time it.. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "MDW" wrote in message Hello, I'm going to be comparing a bunch of string variables in a case-insensitive scenario. I will be using the tried and true method of "If LCase(string1) = LCase(string2) Then..." However, I'm going to be doing this thousands of times. It's irrelevant to me if I compare the strings in upper case or lower. Is it any more "work" for VBA to convert a string to all uppers vs all lowers (or vice versa)? Is ~5,000 conversions enough for any difference (if there is one) to impact performance? Thanks. -- Hmm...they have the Internet on COMPUTERS now! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
Option Compare Text makes all text comparisons case insensitive. Regards, Jim Cone San Francisco, USA http://www.officeletter.com/blink/specialsort.html "Gary Keramidas" <GKeramidasATmsn.com wrote in message jim i have a question on this and the option compare text if i run the following code with option compare text under option explicit, i get "the same" if i remove option compare text, i get "different" why the difference? Sub test() str1 = "Gary" str2 = "gary" If str1 Like str2 Then MsgBox "the same" Else MsgBox "different" End If End Sub -- Gary "Jim Cone" wrote in message ... If I were doing it I would use the "Like" operator... If string1 Like string2 Then This requires the "Option Compare Text" statement at the top of the module. I doubt if there is any difference in the time required for Ucase vs. Lcase. If time is an issue, then run each code version and time it.. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "MDW" wrote in message Hello, I'm going to be comparing a bunch of string variables in a case-insensitive scenario. I will be using the tried and true method of "If LCase(string1) = LCase(string2) Then..." However, I'm going to be doing this thousands of times. It's irrelevant to me if I compare the strings in upper case or lower. Is it any more "work" for VBA to convert a string to all uppers vs all lowers (or vice versa)? Is ~5,000 conversions enough for any difference (if there is one) to impact performance? Thanks. -- Hmm...they have the Internet on COMPUTERS now! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ok, got it thanks.
it eliminates the need to make the case the same to find a match. -- Gary "Jim Cone" wrote in message ... Gary, Option Compare Text makes all text comparisons case insensitive. Regards, Jim Cone San Francisco, USA http://www.officeletter.com/blink/specialsort.html "Gary Keramidas" <GKeramidasATmsn.com wrote in message jim i have a question on this and the option compare text if i run the following code with option compare text under option explicit, i get "the same" if i remove option compare text, i get "different" why the difference? Sub test() str1 = "Gary" str2 = "gary" If str1 Like str2 Then MsgBox "the same" Else MsgBox "different" End If End Sub -- Gary "Jim Cone" wrote in message ... If I were doing it I would use the "Like" operator... If string1 Like string2 Then This requires the "Option Compare Text" statement at the top of the module. I doubt if there is any difference in the time required for Ucase vs. Lcase. If time is an issue, then run each code version and time it.. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "MDW" wrote in message Hello, I'm going to be comparing a bunch of string variables in a case-insensitive scenario. I will be using the tried and true method of "If LCase(string1) = LCase(string2) Then..." However, I'm going to be doing this thousands of times. It's irrelevant to me if I compare the strings in upper case or lower. Is it any more "work" for VBA to convert a string to all uppers vs all lowers (or vice versa)? Is ~5,000 conversions enough for any difference (if there is one) to impact performance? Thanks. -- Hmm...they have the Internet on COMPUTERS now! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I get VBA script to read a word with both lcase and ucase lett | Excel Programming | |||
UCase? | Excel Programming | |||
Get…UCase or LCase ??? | Excel Programming | |||
Get…UCase or LCase ??? | Excel Programming | |||
UCase Help | Excel Programming |