Ask a Question

Unable to split the string using Chr(150)

muttu
Occasional Contributor

Unable to split the string using Chr(150)


Trying to spilt the string using Chr(150) which is ASCI  representation of "-". But below error is displayed.



Sub SplitDemo2


SplitDemo2

Dim s, ss


s = "May 26 - June 25"


' Split at line break character.


ss = Split(s, Chr(150))


Log.Message("There are " & (UBound(ss)+1) & " words in the array")


Log.Message("The first word is: " & ss(0))


Log.Message("The first word is: " & ss(1))


 


 



End Sub






Result





An exception occurred in the "FS_OnlineLease" unit at line 854:

Microsoft VBScript runtime error

Subscript out of range: '[number: 1]'
2 REPLIES 2
YMinaev
Staff

Hi,



Zip the entire project suite directory with the log of the failed test execution and send it to us.



Make sure that the latest log of the failed test execution corresponds to the latest version of your test (there have been no modifications in the test since the last test log was generated).
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
YMinaev
Staff

Hi,



We've found a problem in your code. The "-" symbol has the #45 code, while you're trying #150. Use Chr(45) instead of Chr(150).
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: