Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

case recognitionhelp please!

Status
Not open for further replies.

mickymoo

Programmer
Apr 4, 2002
23
GB
I have written a named entity recogniser. Is there a method to get the program to recognise whether a character in a txt file is uppercase or lower case. I don't care what letter it is, I just want the program to recognise if a letter is Ucase or Lcase. At the moment I am doing a string comparison from a .txt file, bt there must be a better way than this.

Any thoughts gratefully appreciated
 
?

Code:
Option Explicit

Private Sub Command1_Click()
  Print IsLower(Left$(Text1.Text, 1))
End Sub

Private Function IsLower(ByVal sText As String) As Boolean
  Dim sTemp As String
  
  sTemp = LCase$(sText)
  
  IsLower = (sTemp = sText)
End Function
 

Caution: The above will not work if Option Compare is set to Text. The default is of course Binary, but if you have in the declarations section of the module:

Option Compare Text

then you will either need to change it to (or just remove it):

Option Compare Binary

or you will need to use the StrComp function:

StrComp(Sting1, String2, vbBinaryCompare)



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top