'------------------------------------- 'Author: Eric D. Burdo 'URL: http://www.redleif.com 'Added: 31-June-2000 '------------------------------------- 'Program: ALTERNATECASE.ZIP '------------------------------------- 'Description: This sample takes a string, 'and alternates the chars from uppercase 'to lowercase inside the string. '------------------------------------- Option Explicit
Private Sub Form_Load() Const kString As String = "AbCdEfGh" Dim i As Integer Dim sBuff As String, sFinished As String
For i = 1 To Len(kString) 'Loop through every char in the string sBuff = Mid$(kString, i, 1) 'Store just that char Select Case Asc(sBuff) 'What is the Ascii value for the char Case 65 To 90 'If it is upper case letter, sBuff = LCase(sBuff) 'LCase the letter Case 97 To 122 'If it is lower case letter sBuff = UCase(sBuff) 'UCase the letter Case Else 'Not a letter 'Do nothing, but you could check 'for numbers or something End Select sFinished = sFinished & sBuff 'Store the finished result Next i Debug.Print kString, sFinished '*** DEBUG CODE *** End Sub
Downloads In IE right-click and select 'Save Target As...' or in Netscape
right-click and select 'Save Link As...' View Plain Text
Download Demo Project
Not Available
|