How to remove carriage return characters in results so I can compare with data table in QuickTest Professional
Tags:
Question ID: 104279
2
0

I am trying to use my VerifyVal function for text checks on fields that may contain several lines of text. I need to compare the text in a resource with out carriage. Do you know of way this can be done?

Marked as spam
Posted by (Questions: 22, Answers: 6)
Asked on November 23, 2010 9:39 pm
49 views
Answers (1)
7
Private answer

I would recommend create a function call to remove all extra non printable characters then also change StrComp to use text compare instead of binary so the system does not have to convert every thing to lower case. Here is an example.


Function RmExtra(myString)
 myString=Replace(myString,vbCr,'''')
 myString=Replace(myString,vbLf ,'''')
 myString=Replace(myString,vbTab ,'''')
 myString=Replace(myString,vbFormFeed ,'''')
 myString=Replace(myString,vbTab ,'''')
 myString=Replace(myString,'' '' ,'''') ' for a space
 RmExtra=myString
End Function   
aaa =''TestTEST''
bbb=''TEST''& vbCr & ''TEST'' & vbCr 
ccc=bbb
ccc=RmExtra(ccc)
MsgBox ''aaa='' & aaa &''*''
MsgBox ''bbb='' & bbb &''*''
MsgBox ''ccc='' & ccc &''*''
'This works as a text compare and does not worry about case
r1 =StrComp(aaa,ccc,1)   
MsgBox  ''opt1='' & r1
'This does not work because it is a binary compare
r0 =StrComp(aaa,ccc,0)
MsgBox ''opt0='' & r0

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on November 23, 2010 9:55 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top