Given string:
bhojaraju007@gmail.com
Output:
Characters:bhojarajugmailcom
Numbers:007
Spl.Characters:@.
Steps:
----------
First, we find Length of string
Using loop and mid method we find each and every character from given string
Syntax
----------------
Mid(string, Start, Number of characters)
Script
---------------
Dim str,strlen,strstart
Dim temp
Dim numeric, strChar, splChar
str="bhojaraju007@gmail.com"
strlen=Len(str)
For strstart=1 to strlen
temp=Mid(str,strstart,1)
If IsNumeric(temp) Then 'IsNumeric is VB method to get only Numeric values
numeric=numeric+temp
'If Character between A-Z a-z will store in strChar
Elseif ASC(temp)>64 and ASC(temp)<123 Then
strChar=strChar+temp
Else
splChar=splChar+temp 'Else all character(Spl.Charaters will store)
End If
Next
msgbox strChar
msgbox numeric
msgbox splChar
bhojaraju007@gmail.com
Output:
Characters:bhojarajugmailcom
Numbers:007
Spl.Characters:@.
Steps:
----------
First, we find Length of string
Using loop and mid method we find each and every character from given string
Syntax
----------------
Mid(string, Start, Number of characters)
Script
---------------
Dim str,strlen,strstart
Dim temp
Dim numeric, strChar, splChar
str="bhojaraju007@gmail.com"
strlen=Len(str)
For strstart=1 to strlen
temp=Mid(str,strstart,1)
If IsNumeric(temp) Then 'IsNumeric is VB method to get only Numeric values
numeric=numeric+temp
'If Character between A-Z a-z will store in strChar
Elseif ASC(temp)>64 and ASC(temp)<123 Then
strChar=strChar+temp
Else
splChar=splChar+temp 'Else all character(Spl.Charaters will store)
End If
Next
msgbox strChar
msgbox numeric
msgbox splChar
No comments:
Post a Comment
Note: only a member of this blog may post a comment.