This blog contains QTP FAQs and QTP & Testing Interview Questions.
thank for share, it is very important .￣︿￣
'Here is how we can Reverse a String without using any functions like len & midOption ExplicitDim yourstr,r,letter,resultyourstr="program"Set r=new regexpr.pattern="[a-z A-Z]"r.global=trueset s=r.execute(yourstr)For each letter in s result= letter.value&resultNextprint result
Thanks for your post J B C.But i wanted to know what that pattern means?r.pattern="[a-z A-Z]"
This pattern means that it will reverse any string which contains range of letters from a to z and A to Z and also range of numericals from 0 to 9.So, if you keep your pattern like "[a-z A-Z]" and suppose you give your string as "QUeR123y"; so your answer will be "yReUQ". It will not consider the numbers since you skipped them when you defined your pattern.I hopr you got it.
Post a Comment