Public Function IsGoodUCase(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 charU 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(UCase$(charOrg)) Then
        ' 63 = "?" comes very often, probably means: UCase Unknown
        If AscW(UCase$(charOrg)) <> 63 Then
          If UCase03(charOrg) <> UCase$(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)
        charU = UCase02(charOrg)
        If charU <> UCase$(charOrg) Then
          ' stooges: WHY do numbers > 255 come up at all ???
          '  154/353    138/352
          '  156/339    140/338
          '  158/382    142/381
          '  255/255    159/376
          Debug.Print "' "; charOrg & " " & Asc(charOrg) & "/" & AscW(charOrg), _
                     UCase$(charOrg) & " " & Asc(UCase$(charOrg)) & "/" & AscW(UCase$(charOrg))
          Stop
          fFailed = True
        End If
      Next
      
      sFoo = Chr$(154) & Chr$(156) & Chr$(158) & Chr$(255)
      If UCase02(sFoo) <> UCase$(sFoo) Then Stop: fFailed = True
      
      sFoo = "HeyHey"
      If UCase02(sFoo) <> UCase$(sFoo) Then Stop: fFailed = True
    
      sFoo = ""
      If UCase02(sFoo) <> UCase$(sFoo) Then Stop: fFailed = True
    
    End With
  End If
  
  IsGoodUCase = Not fFailed
End Function


Back to UCase