VB6变量声明中的星号 [英] Asterisks in variable declarations in VB6

查看:41
本文介绍了VB6变量声明中的星号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

变量声明后的星号(*)和数字是什么意思?如 WpName As String * 6

What's the meaning of the asterisk (*) and the number, after the variable declaration? As seen in WpName As String * 6

Public Type WayPoint

   WpIndex As Integer
   WpName As String * 6
   WpLat As Double
   WpLon As Double
   WpLatDir As String * 1
   WpLonDir As String * 1

End Type

推荐答案

星号将变量声明为定长字符串,其中数字表示字符串的长度:

The asterisk declares the variable as a fixed-length string, where the number indicates the length of the string:

http://www.1sayfa.com/1024/diger/vb/ch07.htm#Heading8

固定长度字符串变量的声明包含一个星号 (*),以告诉 Visual Basic 该字符串将是固定长度.最后一个参数 strlength 告诉程序变量可以包含的字符数.

The declaration of a fixed-length string variable contains an asterisk (*) to tell Visual Basic that the string will be a fixed length. The final parameter, strlength, tells the program the number of characters that the variable can contain.

API 调用可能需要它们,请参阅此问题:

They may be required for an API call, see this question:

VB6 - 在 VB6 中使用固定宽度的字符串是否有任何性能优势?

在 VB6 或更早版本中,我唯一一次必须使用固定长度字符串是处理 API 调用.

The only time in VB6 or earlier that I had to use fixed length strings was with working with API calls.

这篇关于VB6变量声明中的星号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆