Imports System
Imports System.Collections.Generic
Public Class Program
Public Shared Sub Main()
Dim str As String = "12:14:36"
Dim time_parts As List(Of String) = New List(Of String)() From {}
Dim pos As Integer = str.IndexOf(":", 0, StringComparison.Ordinal)
While (pos <> -1)
time_parts.Add(str.Substring(0, pos))
str = str.Substring(pos + 1)
pos = str.IndexOf(":", pos, StringComparison.Ordinal)
End While
time_parts.Add(str)
If time_parts.Count <> 3 Then
Console.WriteLine("Invalid time format")
End If
Dim hours As Integer = Integer.Parse(time_parts(0))
Dim minutes As Integer = Integer.Parse(time_parts(1))
Dim seconds As Integer = Integer.Parse(time_parts(2))
Console.WriteLine(hours & ":" & minutes & ":" & seconds)
End Sub
End Class
' run:
'
' 12:14:36
'