VERY easy question

Alphanumeric
02-28-2005, 01:18 PM
Hello.

I'm sorry, it's been a while since I've done this, and I can't recall the correct syntax. How do I ignore the case using the Left$() and Right$() statements?

For example........

If Left$(Variable, 1) = "a" Then MsgBox "Hello!"

Variable could possibly be "a" or "A".


Thanks!

HardCode
02-28-2005, 01:24 PM
If LCase(Left$(Variable, 1)) = "a" Then MsgBox "Hello!"

If UCase(Left$(Variable, 1)) = "A" Then MsgBox "Hello!"


Alternatively, you can put Option Compare Text at the top of the code sheet, after your Option Explicit.

meteo
02-28-2005, 01:24 PM
UCase and LCase

grahamt
02-28-2005, 01:25 PM
You could force it to be upper or lower ...


If Left$(UCase(Variable), 1) = "A" Then MsgBox "Hello!"


Or see Option Compare Text

Alphanumeric
02-28-2005, 01:29 PM
Haha, I feel so stupid now. I've been using LCase and UCase elsewhere in my program too. :o

How could I have forgotten? Hah, oh well. Thanks for your help! :D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum