Public Function IsGoodLCase(Optional fUnicode As Boolean) As Boolean
' note: fUnicode is not used for VBspeed's ANSI UCase/LCase
  Dim i As Long
  Dim charOrg As String
  Dim charL As String
  Dim sFoo As String
  Dim fFailed As Boolean
  
  If fUnicode Then
    ' Unicode
    For i = &H8000 To &H7FFF
      charOrg = ChrW$(i)
      If AscW(charOrg) <> AscW(LCase$(charOrg)) Then
        ' 63 = "?" comes very often, probably means: LCase Unknown
        If AscW(LCase$(charOrg)) <> 63 Then
          If LCase02(charOrg) <> LCase$(charOrg) Then
            Stop: fFailed = True
          End If
        End If
      End If
    Next
  
  Else
    ' ASCII/ANSI
    With New CCaseDon
      
      For i = 0 To 255
        charOrg = Chr$(i)
        charL = LCase02(charOrg)
        If charL <> LCase$(charOrg) Then
          ' stooges: WHY do numbers > 255 come up at all ???
          ' Š 138/352   š 154/353
          ' Œ 140/338   œ 156/339
          ' Ž 142/381   ž 158/382
          ' Ÿ 159/376   ÿ 255/255
          Debug.Print "' "; charOrg & " " & Asc(charOrg) & "/" & AscW(charOrg), _
                     LCase$(charOrg) & " " & Asc(LCase$(charOrg)) & "/" & AscW(LCase$(charOrg))
          'Stop
          fFailed = True
        End If
      Next
      
      sFoo = Chr$(138) & Chr$(140) & Chr$(142) & Chr$(159)
      If LCase02(sFoo) <> LCase$(sFoo) Then Stop: fFailed = True
      
      sFoo = "HeyHey"
      If LCase02(sFoo) <> LCase$(sFoo) Then Stop: fFailed = True
    
      sFoo = ""
      If LCase02(sFoo) <> LCase$(sFoo) Then Stop: fFailed = True
    
    End With
  End If
  
  IsGoodLCase = Not fFailed
End Function


Back to LCase