Output yang dihasilkan berupa array.
Formula:
String.Split(separator as Char)
separator = karakter pembatas
Contoh:
Membuat List per Kata dalam Satu Kalimat/Nilang String.
UI:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "Process"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim kalimat() As String
Dim spasi() As Char = {" "c}
Dim kata As String
kalimat = TextBox1.Text.Split(spasi)
For Each kata In kalimat
ListBox1.Items.Add(kata)
Next
End Sub
End Class
Runtime:
Click here if you like this article.
1 Comments