Quality is delighting customers
Deal All,
Recently i face one interview question str="test12@#3456" In This i want to print like special character and numeric ,word in one script please tell me how to write the code for this
Thanks Balaji
Tags:
I think there is no dependency of any tool to print special character. Answer is
String a = "test12@#3456";
System.out.println(a);
str="test12@#3456ABC"
strlen = len(str)
result=" "
For i = 1 To strlen
strmid = mid(str, i, 1)
If (Asc(strmid)>=97 and Asc(strmid) <= 122) OR (Asc(strmid) >= 65 and (Asc(strmid) <= 90)) Then
print "its alphabet"
else
result =result & strmid
End If
Next
print result
Hey Balaji,
Below is the code to print the special chars, number and characters. Coding style and naming convention may change as per automation testing company
Dim stringContent,stringLen,strStartWith
Dim temp
Dim numeric, strChar, splChar
stringContent="hkdhahkk18755@%#$#_"
stringLen=Len(stringContent)
For strStartWith=1 to stringLen
temp=Mid(stringContent,strStartWith,1)
If IsNumeric(temp) Then 'IsNumeric is VB method to get only Numeric values
numeric=numeric+temp
Elseif ASC(temp)>64 and ASC(temp)<123 Then 'If Character between A-Z a-z will store in strChar
strChar=strChar+temp
Else
splChar=splChar+temp 'Else all character(Spl.Charaters will store)
End If
Next
msgbox strChar
msgbox numeric
msgbox splChar
© 2021 Created by Quality Testing.
Powered by