[英]What mean «String$» in VBA?
Got strange Access project, where found this line: 有一个奇怪的Access项目,在这里找到以下行:
strUserName = String$(39, 0)
What String$
means? String$
是什么意思?
What String$ means? String $是什么意思?
String$()
means almost the same as String()
, but String()
can accept and return a Variant and String$()
can not. String$()
含义与String()
几乎相同,但是String()
可以接受并返回Variant,而String$()
不能。
For example, String()
will accept Null for the character argument and return Null ... 例如, String()
将接受Null作为字符参数,并返回Null ...
? String(5, Null)
Null
But substituting String$()
for String()
triggers error 94, "Invalid use of Null" ... 但是用String$()
替换String$()
String()
会触发错误94, “无效使用Null” ...
? String$(5, Null)
Regarding your example ... String$(39, 0)
... that returns a string of 39 null-byte characters ( Chr(0)
), which is not the same as Null. 关于您的示例... String$(39, 0)
...返回一个由39个空字节字符( Chr(0)
)组成的字符串,该字符串与Null不同。
It's an inbuilt function, normally used without the $
: 这是一个内置函数,通常不带$
:
String(number, character)
It returns a string with <number>
characters. 它返回一个包含<number>
字符的字符串。
Eg String(5, "A")
-> AAAAA 例如String(5, "A")
-> AAAAA
Apparently you can also use the Ascii code for character
, so your example returns 39 * Chr(0). 显然,您也可以将Ascii代码用于character
,因此您的示例返回39 * Chr(0)。
string表示字符y的长度为x的字符串,因此string(5,33)=“ !!!!!”,即39 chr(0)的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.