Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Sunday, 6 January 2019

Finding characters, numbers and special characters

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



No comments:

Post a Comment

Note: only a member of this blog may post a comment.