Skip to content

WOCT


将数字转换为 Unicode 八进制表示

语法

vb
declare function Woct ( byval number as ubyte ) as wstring
declare function Woct ( byval number as ushort ) as wstring
declare function Woct ( byval number as ulong ) as wstring
declare function Woct ( byval number as ulongint ) as wstring
declare function Woct ( byval number as const any ptr ) as wstring

declare function Woct ( byval number as ubyte, byval digits as long ) as wstring
declare function Woct ( byval number as ushort, byval digits as long ) as wstring
declare function Woct ( byval number as ulong, byval digits as long ) as wstring
declare function Woct ( byval number as ulongint, byval digits as long ) as wstring
declare function Woct ( byval number as const any ptr, byval digits as long ) as wstring

用法

result = Woct( number [, digits ] )

参数

number

要转换为八进制表示的数字。

digits

返回字符串中所需的位数。

返回值

数字的 Unicode 八进制表示,如果指定了位数,则截断或用零("0")左填充以符合指定位数。

说明

返回 number 的八进制 Wstring(Unicode)表示。八进制位从 07

如果指定 digits > 0,结果字符串将恰好为该长度。如有必要,将从左侧截断或用零填充。

返回字符串的长度不会超过 number 类型所需的最大位数(byte 为 3 个字符,short 为 6 个,long 为 11 个,longint 为 22 个)。

示例

start GeSHi

vb
Print WOct(54321)
Print WOct(54321, 4)
Print WOct(54321, 8)

end GeSHi

将产生如下输出:

152061
2061
00152061

方言差异

  • -lang qb 方言中不可用,除非使用别名 __Woct 引用。

平台差异

  • FreeBASIC 的 DOS 移植版本不支持 Unicode 字符串。

与QB的区别

  • QBASIC 不支持 Unicode。

参见

  • Wbin
  • Whex

返回 目录

基于 FreeBASIC 官方文档翻译 如有侵权请联系我们删除
FreeBASIC 是开源项目,与微软公司无隶属关系