Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IsAlpha etc
#4
You should be able to suss out an IsUpper and IsLower by dissecting IsAlpha

or 

Code: (Select All)

FUNCTION IsUpperLetter(L as String)
  IsUpperLetter = ( ASC(L) >= ASC("A") and ASC(L) <= ASC("Z"))
END FUNCTION

FUNCTION IsLowerLetter(L as String)
   IsLowerLetter =  ( ASC(L) >= ASC("a") and ASC(L) <= ASC("z") )
END FUNCTION

FUNCTION IsLetter (L as String)
  IsLetter = IsLowerLetter(L) or IsUpperLetter(L)
END FUNCTION

FUNCTION IsWhiteSpace(L as String)
DIM C AS INTEGER
    C = ASC(L)
    IsWhiteSpace = C=32 or C=9 or C=8 or C=13 or C=10 or C=7
END FUNCTION


FUNCTION IsAlpha(S as String)
  DIM TMP AS INTEGER
  DIM I AS LONG
  TMP = _True

  FOR I = 1 to Len(S)
      If IsLetter(MID$(S,I,1)) or IsWhiteSpace(MID$(S,I,1)) THEN
          _Continue
      Else
          TMP = _False
          Exit For
      End If
  Next
  IsAlpha = TMP
End FUNCTION

FUNCTION IsUpper(S as String)
  DIM TMP AS INTEGER
  DIM I AS LONG
  TMP = _True

  FOR I = 1 to Len(S)
      If IsUpperLetter(MID$(S,I,1)) or IsWhiteSpace(MID$(S,I,1)) THEN
          _Continue
      Else
          TMP = _False
          Exit For
      End If
  Next
  IsAlpha = TMP
End FUNCTION

FUNCTION IsLower(S as String)
  DIM TMP AS INTEGER
  DIM I AS LONG
  TMP = _True

  FOR I = 1 to Len(S)
      If IsLowerLetter(MID$(S,I,1)) or IsWhiteSpace(MID$(S,I,1)) THEN
          _Continue
      Else
          TMP = _False
          Exit For
      End If
  Next
  IsAlpha = TMP
End FUNCTION




You do know you can force to Upper or Lower with UCASE$ & LCASE$ . 

   If I need to do case insensitive or case sensitive comparisons I use these.
Reply


Messages In This Thread
IsAlpha etc - by PhilOfPerth - 01-21-2026, 10:36 PM
RE: IsAlpha etc - by ahenry3068 - 01-21-2026, 10:45 PM
RE: IsAlpha etc - by SMcNeill - 01-22-2026, 05:44 PM
RE: IsAlpha etc - by ahenry3068 - 01-21-2026, 10:56 PM
RE: IsAlpha etc - by ahenry3068 - 01-21-2026, 11:07 PM
RE: IsAlpha etc - by Pete - 01-22-2026, 12:09 AM
RE: IsAlpha etc - by ahenry3068 - 01-22-2026, 12:23 AM
RE: IsAlpha etc - by PhilOfPerth - 01-22-2026, 12:41 AM
RE: IsAlpha etc - by SMcNeill - 01-22-2026, 04:14 PM
RE: IsAlpha etc - by a740g - 01-22-2026, 06:03 PM
RE: IsAlpha etc - by PhilOfPerth - 01-22-2026, 10:32 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)