In this blog post, we will see how to normalize strings in HP QTP (UFT). Below code receives string and then convert it to equivalent string in a regular expression format. Below snippet uses Replace function.
Msgbox NormalizeStringFunc ("Q+A*I.n?sight\s") Function NormalizeStringFunc(MyStr) Dim TempStr TempStr = Replace(MyStr, "\", "\\") TempStr = Replace(TempStr, "*", "\*") TempStr = Replace(TempStr, "+", "\+") TempStr = Replace(TempStr, ".", "\.") NormalizeStringFunc = Replace(TempStr, "?", "\?") End function
Output of above code is as shown below.
[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to normalize strings in HP QTP (UFT) – QAInsights” alt=”How to normalize strings in HP QTP (UFT) – QAInsights” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-normalize-strings-in-HP-QTP-UFT-QAInsights.jpg[/auto_thumb]
Thanks for visiting QAInsights! Check out our new portal Testifications.com to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything. Searching for QA Jobs Openings, check it at www.QAJobOpenings.com
Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.
Subscribe to our QAInsights YouTube Channel | Subscribe our free weekly newsletter.