Octal To Decimal

This algorithm converts octal numbers to decimal numbers.



									Public Shared Function OctalToDecimal(octal As String) As Integer
	Dim octLength As Integer = octal.Length
	Dim dec As Double = 0

	For i As Integer = 0 To octLength - 1
		dec += (CByte(AscW(octal(i))) - 48) * Math.Pow(8, ((octLength - i) - 1))
	Next

	Return CInt(Math.Truncate(dec))
End Function
								


Example

									Dim data = "2430357"
Dim value = OctalToDecimal(data)
								


Output

									667887