Reputation: 2508
Got strange Access project, where found this line:
strUserName = String$(39, 0)
What String$
means?
Upvotes: 0
Views: 3037
Reputation: 97101
What String$ means?
String$()
means almost the same as String()
, but String()
can accept and return a Variant and String$()
can not.
For example, String()
will accept Null for the character argument and return Null ...
? String(5, Null)
Null
But substituting String$()
for String()
triggers error 94, "Invalid use of 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.
Upvotes: 6
Reputation: 8531
string means a string of length x of character y, so string (5,33)="!!!!!", thats 39 chr(0)'s
Upvotes: 0
Reputation: 27634
It's an inbuilt function, normally used without the $
:
String(number, character)
It returns a string with <number>
characters.
E.g. String(5, "A")
-> AAAAA
Apparently you can also use the Ascii code for character
, so your example returns 39 * Chr(0).
Upvotes: 2