Name
Oct Function
Syntax
Oct(number
)
-
number
Use: Required
Data Subtype: Numeric or String
Number or string representation of a number to convert.
Return Value
A Variant of subtype String.
Description
Returns the octal value of a given number.
Rules at a Glance
If
number
isn’t already a whole number, it’s rounded to the nearest whole number before being evaluated.If
number
isNull
,Oct
returnsNull
.If
number
is the specialEmpty
variant,Oct
returns (zero).Oct
returns up to 11 octal characters.
Programming Tips & Gotchas
You can also use literals in your code to represent octal numbers by
appending &O
to the relevant octal value. For
example, 100 decimal has the octal representation
&O144
. The following statement assigns an
octal value to a variable:
lngOctValue1 = &H200 ' Assigns 128
See Also
Hex Function |
Get VBScript in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.