How it works?
- Design user interface, add labels, text boxes and button. (see the design below)
- Inside the button event add the code snippet.
- Run the program
Private Sub Command1_Click()
arr = Split(Text1.Text, ",", -1)
For i = LBound(arr) To UBound(arr)
arr(i) = arr(i)
Next
Text2.Text = arr(0)
arr = Split(arr(1), " ", -1)
For i = LBound(arr) To UBound(arr)
arr(i) = arr(i)
Next
If UBound(arr) = 2 Then
Text3.Text = arr(UBound(arr) - 1)
ElseIf UBound(arr) = 3 Then
Text3.Text = arr(UBound(arr) - 2) & " " & arr(UBound(arr) - 1)
ElseIf UBound(arr) = 4 Then
Text3.Text = arr(UBound(arr) - 3) & " " & arr(UBound(arr) - 2) & " " & arr(UBound(arr) - 1)
ElseIf UBound(arr) = 5 Then
Text3.Text = arr(UBound(arr) - 4) & " " & arr(UBound(arr) - 3) & " " & arr(UBound(arr) - 2) & " " & arr(UBound(arr) - 1)
End If
Text4.Text = arr(UBound(arr))
End Sub
Programming Language: Vb6