Thank you very much Jon!
It works perfectly..
Robert
Announcement
Collapse
No announcement yet.
hs.StringItem replacement
Collapse
X
-
When HS3 first came out, I wrote a function to replicate hs.Stringitem.
Place the following code at the bottom of your script. Then change any references in your script from hs.StringItem to just Stringitem.
Code:Function Stringitem(ByVal Str As String, ByVal Index As Integer, Byval Sep As String) As String Try Dim Result() As String = System.Text.RegularExpressions.Regex.Split(Str, System.Text.RegularExpressions.Regex.Escape(Sep)) Return Result(Index-1) Catch Return "" End Try End Function
Leave a comment:
-
Check out the .net split function. It's nearly identical.
https://www.dotnetperls.com/split-vbnet
Leave a comment:
-
hs.StringItem replacement
I have a HS2 script I'd like to convert to HS3 but noticed that hs.StringItem no longer exists. Can someone suggest a workaround to the section below which uses it?
PHP Code:For I=0 to UBound(section_items)
Dim the_date_time As String
Dim the_name As String
Dim the_note As String
the_date_time = hs.StringItem(section_items(I),1,"=")
the_name = hs.StringItem(section_items(I),2,"=")
the_note = hs.StringItem(section_items(I),3,"=")
If the_name = "SUMP OFF" Then
dev_string = dev_string & "<img src=\MyImgs\led-red.gif> <small>" & the_name & " @ " & the_date_time & " " & the_note & "</small> <br>"
Else
dev_string = dev_string & "<img src=\MyImgs\led-green.gif> <small>" & the_name & " @ " & the_date_time & " " & the_note & "</small> <br>"
End If
Next
RobertTags: None
Leave a comment: