Is there a way by which we can get each character from a string using VBScript? I used a function Mid, but I just want to know if there are other direct functions that, when used, return every character starting with a string.
Mid
strString = "test" For i=1 To Len(strString) WScript.Echo Mid(strString,i,1) Next
AFAIK, Midis the only way to do this.
a="abcd" for i=1 to len(a) msgbox right(left(a,i),1) next
Another way to do this, starting at 0:
str = "hola che" x=Len(str) text = "" For i=0 to x-1 'x-1 is because it exceeds the actual length text= text & Mid(str,i+1,1) Next msgbox text
This code is useful for distinguishing between Ucase and Lcase.
Dim a a="StAcKoVeRfLoW" for i=o to len(a)-1 if mid(a,i+1,1)=ucase(mid(a,i+1,1)) then b=mid(a,i+1,1) msgbox b end if next