- Left digunakan untuk Mengambil karakter dari kiri
- Mid digunakan untuk Mengambil karakter di tengah
- Right digunakan untuk Mengambil karakter dari kanan
Contoh Program
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
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
Tidak ada komentar:
Posting Komentar