Forum Discussion

muttu's avatar
muttu
Occasional Contributor
14 years ago

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

  • 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).
  • 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).