Produk Bisnis Online
Penghasilan dari Internet

Belajar Manipulasi String


Rancang form seperti berikut :


Silahkan Ketik Sourcenya dibawah ini :
Public Class Frm_Bpc3

    Private Sub btnlen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlen.Click
        hasil.Text = Microsoft.VisualBasic.Len(kata.Text)

    End Sub


    Private Sub btnreplace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnreplace.Click
        Dim nilaiawal, nilaiakhir As String
        nilaiawal = "Visual Basic 2008"
        nilaiakhir = Replace(nilaiawal, "Studio", "Basic")
        hasil.Text = nilaiakhir
    End Sub

    Private Sub btninstr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btninstr.Click
        Dim kata As String
        Dim posisi As Integer
        kata = "Visual Basic"
        posisi = InStr(kata, "i")
        hasil.Text = posisi

    End Sub

    Private Sub btnleft_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnleft.Click
        hasil.Text = Microsoft.VisualBasic.Left(kata.Text, 3)

    End Sub

    Private Sub btnright_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnright.Click
        hasil.Text = Microsoft.VisualBasic.Right(kata.Text, 3)

    End Sub

    Private Sub btnmid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmid.Click
        hasil.Text = Microsoft.VisualBasic.Mid(kata.Text, 3, 2)

    End Sub

    Private Sub btntrim_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntrim.Click
        hasil.Text = Microsoft.VisualBasic.Trim(kata.Text)

    End Sub

    Private Sub btnltrim_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnltrim.Click
        hasil.Text = Microsoft.VisualBasic.LTrim(kata.Text)
    End Sub

    Private Sub btnrtrim_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnrtrim.Click
        hasil.Text = Microsoft.VisualBasic.RTrim(kata.Text)
    End Sub

  
    Private Sub Frm_Bpc3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        hasil.Text = ""
        kata.Text = ""
    End Sub
End Class