Conversion.Oct Method

Definition

Returns a string representing the octal value of a number.

Overloads

Oct(UInt64)

Returns a string representing the octal value of a number.

Oct(UInt32)

Returns a string representing the octal value of a number.

Oct(UInt16)

Returns a string representing the octal value of a number.

Oct(SByte)

Returns a string representing the octal value of a number.

Oct(Byte)

Returns a string representing the octal value of a number.

Oct(Int64)

Returns a string representing the octal value of a number.

Oct(Int32)

Returns a string representing the octal value of a number.

Oct(Int16)

Returns a string representing the octal value of a number.

Oct(Object)

Returns a string representing the octal value of a number.

Oct(UInt64)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.Conversion.Oct(Int64)

Returns a string representing the octal value of a number.

C#
[System.CLSCompliant(false)]
public static string Oct(ulong Number);

Parameters

Number
UInt64

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Attributes

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Oct(UInt32)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.Conversion.Oct(Int32)

Returns a string representing the octal value of a number.

C#
[System.CLSCompliant(false)]
public static string Oct(uint Number);

Parameters

Number
UInt32

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Attributes

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Oct(UInt16)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.Conversion.Oct(Int16)

Returns a string representing the octal value of a number.

C#
[System.CLSCompliant(false)]
public static string Oct(ushort Number);

Parameters

Number
UInt16

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Attributes

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Oct(SByte)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.Conversion.Oct(Byte)

Returns a string representing the octal value of a number.

C#
[System.CLSCompliant(false)]
public static string Oct(sbyte Number);

Parameters

Number
SByte

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Attributes

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Oct(Byte)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Returns a string representing the octal value of a number.

C#
public static string Oct(byte Number);

Parameters

Number
Byte

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Oct(Int64)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Returns a string representing the octal value of a number.

C#
public static string Oct(long Number);

Parameters

Number
Int64

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Oct(Int32)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Returns a string representing the octal value of a number.

C#
public static string Oct(int Number);

Parameters

Number
Int32

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Oct(Int16)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Returns a string representing the octal value of a number.

C#
public static string Oct(short Number);

Parameters

Number
Int16

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Oct(Object)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

Returns a string representing the octal value of a number.

C#
public static string Oct(object Number);

Parameters

Number
Object

Required. Any valid numeric expression or String expression.

Returns

A string representing the octal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

Examples

This example uses the Oct function to return the octal value of a number.

VB
Dim testOct As String
' Returns "4".
testOct = Oct(4)
' Returns "10".
testOct = Oct(8)
' Returns "713".
testOct = Oct(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Oct returns
Empty Zero (0)
Any other number Up to 22 octal characters

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1