O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Oct Function

Syntax

Oct(number)
number

Use: Required

Data Type: Numeric or String

Number or string representation of a number to convert.

Return Value

A String.

Description

Returns a string containing the octal representation 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 is Null, Oct returns Null.

  • If number is the special Empty variant, Oct returns 0 (zero).

  • Oct returns up to 11 octal characters.

Programming Tips and 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 = &o200                    ' Assigns 128

See Also

Hex Function

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required