Custom Search

Monday, September 20, 2010

write the code to reverse a string without using Strrev built in function.

Dim i
Dim iStrLen
Dim strOut
Dim strTmp
Dim strMyString
strString=("Please enter the string to be reversed:")
iStrLen = Len(strString)
For i = 0 To Len(strString) - 1
         strOut = Mid(strString, iStrLen - i, 1)
         strTmp = strTmp & strOut
Next
strMyString = strTmp
msgbox strMyString
--------------------Second Scenario-----------
MyStr = inputbox("Enter the String:")
nCnt = Len(MyStr)
For i = 1 to nCnt
   RevStr = Mid(MyStr,i,1)&RevStr
Next
Msgbox RevStr
-------------Third Scenario---------------
Dim yourstr,r,letter,result
yourstr="Automation"
Set r=new regexp
r.pattern="[a-z 0-9 A-Z]"
r.global=true
set s=r.execute(yourstr)
For each i in s
    result= i.value&result
Next
msgbox result

No comments:

Post a Comment

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