I am trying to find whether the character is present in a given string or not but unable to search and increment value though it is present
Dim testchar,noOfSpecialChar
noOfSpecialChar=0
Dim specialChars
specialChars="*[@.^$|?#*+!)(_=-]."
for lngIndex = 1 to Len("test@123")
testchar = mid("test@123",lngIndex,1)
if((InStr(specialChars,testchar))) then
noOfSpecialChar=noOfSpecialChar+1
end if
next
InStr()returns the character position if one is found where as you are using it as a boolean condition (TrueorFalse). Changing theIftoIf InStr(specialChars, testchar) > 0 Thenwill give you what you are expecting.