PDA

Click to See Complete Forum and Search --> : How Do You See If Letter Is Upper Case Or Lower?


Eric M
Jan 28th, 2000, 03:04 AM
I need a way to check if a character is upper case or lower case or is there a way in vb to reverse the case of a string like if it were

hELLO it would change to Hello
?
and vica versa

Jan 28th, 2000, 03:22 AM
Option Compare Binary
If temp = UCASE(temp) Then
'temp is uppercase
Else
'temp is lowercase
End If


------------------
Boothman
There is a war out there, and it is about who controls the information, it's all about the information.




[This message has been edited by Boothman_7 (edited 01-28-2000).]

MrChunky
Jan 28th, 2000, 03:31 AM
Yo Eric my man!

To convert from hELLO to Hello, you might need to write your own chunktastic function baby, coz there ain't no built in one me thinks! ;)

As 65-90 is A-Z, and 97-122 is a-z, it should be quite simple to get the character's ASCII code, and convert to it's opposite partner.

Check out the Asc function for the low down man

Later,



------------------
Regards,
The Chunkster

I appologise for my extrovert behaviour

Remeber, Mr Chunky is funky!

Jan 28th, 2000, 03:33 AM
if you want to make it proper case (ie the first letter alwasy capped you can format to the vbpropercase. And the is ucase as said before

netSurfer
Jan 28th, 2000, 03:35 AM
To borrow mr Chunky's example:

strTemp = character you're checking

if asc(strtemp) > 64 and asc(strtemp) < 91 then
strtemp = chr(asc(strtemp) + 32)
elseif asc(strtemp) > 96 and asc(strtemp) < 123 then
strtemp = chr(asc(strtemp) - 32)
end if

add 32 to the asc value of a capital will give you the lower cased letter, subtracting 32 will give you the captial.