views:

394

answers:

3

I just found this in some old code, and I'm not sure what it means.

Dim sTemp As String * 1

What is the * 1 at the end?

Thanks!

+9  A: 

It means that the variable is a string of exactly one character in length.

Essentially, a fixed-length string.

Mike Hofer
Are there performance benefits to doing that?
Matthew Cole
No. It can help with some COM API's though.
le dorfier
"Essentially, a fixed-length string." - In this case, also essentially a character ;)
Joel Coehoorn
"Are there performance benefits to doing that?" Indeed there are because a fixed length string is a value type (a regular String is a reference type). There are drawbacks though due to lack of support in the VB model e.g. can't be used for subproc paramters or function return values.
onedaywhen
+4  A: 

It's a fixed length string of one character. This was handy cause you could define a structure of fixed strings and read a file right into the structure.

JoshBerke
+3  A: 

It creates a fixed-length string. In that example, the variable will only ever contain one character.

DJ