This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Date { | |
| private int day; | |
| private int month; | |
| private int year; | |
| private final String[] monthNames = { | |
| "January", "February", "March", "April", "May", "June", "July", "August", | |
| "September", "October", "November", "December" | |
| }; | |
| private final int[] monthDays = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Module Program | |
| Sub Main() | |
| Dim MyArray() As Integer = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} | |
| Console.WriteLine(LinearSearch(MyArray, 5)) | |
| Console.WriteLine(BinarySearch(MyArray, 9)) | |
| Console.WriteLine(RecursiveBinarySearch(MyArray, 3)) | |
| End Sub | |
| Function LinearSearch(Array() As Integer, Search As Integer) As Boolean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Module Program | |
| Sub Main() | |
| Dim ArrayA() As Integer = {3, 5, 6, 2, 1, 4, 8, 0, 9, 7} | |
| Dim ArrayB() As Integer = {3, 5, 6, 2, 1, 4, 8, 0, 9, 7} | |
| Console.WriteLine("Before Sorting") | |
| Console.WriteLine("============================") | |
| Console.WriteLine("Array A: " & String.Join(",", ArrayA)) | |
| Console.WriteLine("Array B: " & String.Join(",", ArrayB)) | |
| Console.WriteLine("============================") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Imports System.IO | |
| Imports System.Security.Cryptography | |
| Imports System.Text | |
| Imports System.Text.RegularExpressions | |
| Module Program | |
| Const Users As String = "C:\Users\acer\source\repos\FileProcessing\users.txt" | |
| Dim UsernameRegex As New Regex("[a-zA-Z0-9_]{1,16}") | |
| Dim EmailRegex As New Regex("^[^@]+@[^@]+\.[^@]+$") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Module Program | |
| ' I keep using Arr.Clone() to create a new copy of the array instead of having | |
| ' a reference to the original array. VB is too dumb to get a copy of the values of | |
| ' the original array instead of getting a reference of it. | |
| ' Simply put, it's to avoid mutating the original array. | |
| ''' <summary> | |
| ''' Insertion works by having a pointer and a key value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Module Program | |
| Sub Main() | |
| Const Name As String = "Spimy" | |
| Const PiStr As String = "3.14" ' To be converted to Double | |
| ' Val will always convert to type of Double even if the argument provided is an integer | |
| Dim Pi = Val(PiStr) | |
| Console.WriteLine("{0} : Type {1}", PiStr, PiStr.GetType.Name) |