Thursday, June 16, 2016

To Find alphabets, numbers and special char count from given string

str="Trupti12345@gmail.com"
 numbers=0
 alphabets=0
 specialchar=0
 for i = 1 to len(str)
 b = mid(str,i,1)
 if isnumeric(b) then
  numbers=numbers+1
 ElseIf (asc(b)>=97)and (asc(b)<=122) or asc(i)>=65 and asc(i)<=90 then
  alphabets=alphabets+1
 else
  specialchar=specialchar+1
 End if
 next
 msgbox numbers
 msgbox alphabets
 msgbox specialchar

No comments:

Post a Comment