Imports System
Public Module Module1
Function StringBefore(str As String, a As String) As String
Dim posA As Integer = str.IndexOf(a)
If posA = -1 Then
Return ""
End If
Return str.Substring(0, posA)
End Function
Sub Main()
Dim str As String = "VB.NET:C C++:Java"
Console.WriteLine(StringBefore(str, "Java"))
End Sub
End Module
' run:
'
' VB.NET:C C++:
'