Fungsi Left, Mid, Right Console Application VB.Net

alfa6661
- December 08, 2011
0 (0 votes)
Rate :
Penggunaan fungsi left, mid, dan right pada Visual Basic .Net
  1. Left digunakan untuk Mengambil karakter dari kiri
  2. Mid digunakan untuk Mengambil karakter di tengah
  3. Right digunakan untuk Mengambil karakter dari kanan
Sub Main()
 
    Dim a, x As String
    Dim jurusan As String = "TI"
 
    Console.Write("NRP anda     : ")
    a = Console.ReadLine
    If Left(a, 2) = "63" Then
        jurusan = "TI"
    ElseIf Left(a, 2) = "33" Then
        jurusan = "MI"
    Else
        jurusan = "AP"
    End If
 
    Console.WriteLine("Jurusan anda : " & jurusan)
    If Mid(a, 3, 2) < 11 Then
        x = "20"
    Else
        x = "19"
    End If
 
    Console.WriteLine("Taun Masuk   : " & x & Mid(a, 3, 2))
    Console.WriteLine("No urut      : " & Right(a, 3))
 
    Console.ReadKey()
 
End Sub

Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter

– Eric S. Raymond

Have a better explanation?

If you have comments about this post. Please write your comments below

No comments associated with this article