'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim myVar As String
myVar = "This is a test"
Dim myPos As Int
myVar = ExtractBetween("This is a test. This is only a test. For the next sixty seconds.","only", "sixty")
myVar = ExtractBetween("<tag1>This is a test.</tag1> <tag2>This is only a test.</tag2> <tag3>For the next sixty seconds you will be sujected to intense radiation.</tag3>", "<tag1>", "</tag1>")
myVar = ExtractBetween("<tag1>This is a test.</tag1> <tag2>This is only a test.</tag2> <tag3>For the next sixty seconds you will be sujected to intense radiation.</tag3>", "<tag2>", "</tag2>")
myVar = ExtractBetween("<tag1>This is a test.</tag1> <tag2>This is only a test.</tag2> <tag3>For the next sixty seconds you will be sujected to intense radiation.</tag3>" ,"<tag3>", "</tag3>")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ExtractBetween(ExtractFrom As String, StartingWith As String, EndingAt As String) As String
If ExtractFrom.Length = 0 Then
Return "Nothing to Extract"
End If
'Sub Mid(Text As String, Start As Int, Length As Int) As String
If InStr(ExtractFrom, StartingWith) > -1 Then
Else
Return StartingWith & " - not found"
End If
If InStr(ExtractFrom, EndingAt) > -1 Then
Else
Return EndingAt & " - not found"
End If
Dim myStartPos As Int
myStartPos = InStr(ExtractFrom, StartingWith)
myStartPos = myStartPos + StartingWith.Length + 1
Dim myLength As Int
myLength = ExtractFrom.Length - myStartPos + 1
Dim myVarWithLeftRemoved As String
myVarWithLeftRemoved = Mid(ExtractFrom, myStartPos, myLength)
myStartPos = 1
myLength = InStr(myVarWithLeftRemoved, EndingAt)
Dim myVarWithRightRemoved As String
'Sub Left(Text As String, Length As Long)As String
myVarWithRightRemoved = Left(myVarWithLeftRemoved, myLength )
Dim myVar As String
myVar = Trim(myVarWithRightRemoved)
Msgbox ("*" & myVar & "*","")
Return myVar
End Sub
Sub InStr(StrVar As String,SearchStr As String)As Long 'Same as At()
'*** Function by RBSoft
Dim x As Long
x = StrVar.IndexOf(SearchStr)
Return x
End Sub
Sub MB(Message As String)
Msgbox(Message, "")
End Sub
Sub Left(Text As String, Length As Long)As String
If Length>Text.Length Then Length=Text.Length
Return Text.SubString2(0, Length)
End Sub
Sub Right(Text As String, Length As Long) As String
If Length>Text.Length Then Length=Text.Length
Return Text.SubString(Text.Length-Length)
End Sub
Sub Mid(Text As String, Start As Int, Length As Int) As String
If Len(Text) = 0 Then
Return ""
End If
Return Text.SubString2(Start-1,Start+Length-1)
End Sub
Sub Len(Text As String) As Long
Return Text.Length
End Sub
Sub Trim(Text As String) As String
Return Text.Trim
End Sub