Skip to content

WSTR


返回数字或 ASCII 字符串的宽字符串表示形式

语法

vb
declare function Wstr ( byval n as byte ) as wstring
declare function Wstr ( byval n as ubyte ) as wstring
declare function Wstr ( byval n as short ) as wstring
declare function Wstr ( byval n as ushort ) as wstring
declare function Wstr ( byval n as long ) as wstring
declare function Wstr ( byval n as ulong ) as wstring
declare function Wstr ( byval n as longint ) as wstring
declare function Wstr ( byval n as ulongint ) as wstring
declare function Wstr ( byval n as single ) as wstring
declare function Wstr ( byval n as double ) as wstring
declare function Wstr ( byref str as const string ) as wstring
declare function Wstr ( byval str as const wstring ptr ) as wstring

用法

result = Wstr( number )



result = Wstr( string )

参数

number

要转换为宽字符串的数值表达式。

string

要转换为宽字符串的字符串表达式。

返回值

返回数值或字符串表达式的宽字符表示形式。

描述

Wstr 将数值变量转换为其宽字符串表示形式。它是 Str 的宽字符等价函数。

Wstr 还将 ASCII 字符串转换为 Unicode 字符串。如果给定的是宽字符串,则该字符串原样返回。

示例

start GeSHi

vb
#if defined( __FB_WIN32__ )
#include "windows.bi"
#endif

Dim zs As ZString * 20
Dim ws As WString * 20

zs = "Hello World"
ws = WStr(zs)

#if defined( __FB_WIN32__ )

MessageBox(null, ws, WStr("Unicode 'Hello World'"), MB_OK Or MB_ICONINFORMATION)

#else

Print ws
Print WStr("Unicode 'Hello World'")

#endif

end GeSHi

平台差异

  • DOS 不支持 Wstr

方言差异

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

与 QB 的区别

  • FreeBASIC 新增

参见

  • Str
  • Wstring

返回 目录

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