Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Check for Upper Case


Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2011, 11:28 AM
epsilonv epsilonv is offline
Newcomer
 
Join Date: Jun 2011
Posts: 1
Default Check for Upper Case


Edit by Moderator: Re: http://www.xtremevbtalk.com/showthread.php?t=13778

Merrion - I attempted to use the function you provided however in MS Access it did not work correctly. I ended having to convert the string to its ascii value then comparing the number. I'm not certain if a setting needs to be made in order for case to be a valid comparison however this code did work:
Code:
Public Function IsUpper(ByVal sChar As String) As Boolean
    Dim sUpperCase As String
    Dim i, j As Integer
 
    sUpperCase = UCase$(sChar)
    i = Asc(sChar)
    j = Asc(sUpperCase)
    IsUpper = (i = j)
       
End Function
Edit by Moderator: Please do not reply to threads more that 30 days old, as they are considered archive only. Have a look at our Posting Guidelines when you have a chance. I've created a link to the original thread for you. Thanks and welcome to the forum.

Last edited by Cerian Knight; 06-06-2011 at 04:05 PM.
Reply With Quote
  #2  
Old 06-11-2011, 11:55 AM
seenu_1st seenu_1st is offline
Newcomer
 
Join Date: May 2011
Posts: 6
Default

if i understand corectly, u want to check the string whether it is uppercase or not, am i right?
ur function checks only 1st character of string
Reply With Quote
  #3  
Old 06-11-2011, 12:17 PM
seenu_1st seenu_1st is offline
Newcomer
 
Join Date: May 2011
Posts: 6
Default

try this
Code:
Public Function IsUpper(ByVal sChar As String) As Boolean
    Dim sUpperCase As String
 
    sUpperCase = UCase$(sChar)
    IsUpper = InStr(1, sUpperCase, sChar, vbBinaryCompare)
       
End Function
Reply With Quote
  #4  
Old 07-04-2011, 09:29 AM
JTP JTP is offline
Newcomer
 
Join Date: Jul 2011
Location: melbourne australia
Posts: 14
Default

if Asc([char]) = Asc(UCase([char])) then
'is upper
else
'is not upper
endif
Reply With Quote
  #5  
Old 07-04-2011, 03:36 PM
Keeve Keeve is offline
Newcomer
 
Join Date: Feb 2009
Posts: 16
Default

Another simple method to do it

Code:
Function IsUCase(sChar As String) As Boolean
    Dim UpperChar As String
    UpperChar = UCase(sChar)
        
     If sChar = UpperChar Then
          
          'Upper case
          IsUCase = True
         
      Else
             
            'Lower case   
            IsUCase = False
      
      End If
End Function
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->