Saturday 29 August 2015

Change the case of a given string elements

Change the case of a given string elements

str2= "abC**&^dF"
strc=""
For i =1 to len(str2)
    Set ex=New RegExp   
    ex.global= False
    ex.ignoreCase = False
    c=mid(str2, i, 1)
    ex.pattern="[a-z]"
    If ex.test(c) Then
        strc=strc & UCase(c)
    else
        strc=strc & LCase(c)
    End If
Next

msgbox strc

We can also use ASCII Values to change the case..
msgbox chr(65)

No comments:

Post a Comment