Table of contents
TOC
折叠目录
展开目录

LSet 语句LSet Statement

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

左对齐字符串中的字符串变量,或将一个用户定义类型的变量复制到另一个不同的用户定义类型的变量。Left aligns a string within a string variable, or copies a variable of one user-defined type to another variable of a different user-defined type.

语法Syntax

LSetstringvar=字符串LSetstringvar=string

LSetvarname1=varname2LSet语句语法具有下列组成部分:LSetvarname1=varname2 The LSet statement syntax has these parts:

部件Part说明Description
stringvarstringvar必填。字符串变量的名称。Required. Name of string variable.
stringstring必填。字符串表达式,可中左对齐, stringvar。Required. String expression to be left-aligned within stringvar.
varname1varname1必需。要复制到的用户定义类型的变量名。Required. Variable name of the user-defined type being copied to.
varname2varname2必需。要从中复制的用户定义类型的变量名。Required. Variable name of the user-defined type being copied from.

备注LSet将_stringvar_中的所有剩余的字符替换为空格。如果_字符串_的长度大于_stringvar_, LSet会放只最左侧的字符,最长的_stringvar,在_stringvar_中。建议不要使用LSet复制用户定义类型的变量到另一用户定义类型的变量。将一个数据类型的数据复制到不同的数据类型为保留空间可能会导致不可预知的结果。将变量从一种用户定义的类型复制到另一个,当个变量中的二进制数据复制到另一个,而不考虑指定的元素的数据类型的内存空间。RemarksLSet replaces any leftover characters in _stringvar with spaces. If string is longer than stringvar, LSet places only the leftmost characters, up to the length of the stringvar, in stringvar. Using LSet to copy a variable of one user-defined type into a variable of a different user-defined type is not recommended. Copying data of onedata type into space reserved for a different data type can cause unpredictable results. When you copy a variable from one user-defined type to another, the binary data from one variable is copied into the memory space of the other, without regard for the data types specified for the elements.

示例Example

本示例使用LSet语句左对齐一个字符串在字符串变量中。尽管LSet还可以用来将一个用户定义类型的变量复制到另一个变量的不同但兼容,用户定义的类型,则不推荐这样做。由于不同平台之间的数据结构的实现中,而不能保证这种使用LSet是可移植的。This example uses the LSet statement to left align a string within a string variable. Although LSet can also be used to copy a variable of one user-defined type to another variable of a different, but compatible, user-defined type, this practice is not recommended. Due to the varying implementations of data structures among platforms, such a use of LSet can't be guaranteed to be portable.

Dim MyString 
MyString = "0123456789" ' Initialize string. 
Lset MyString = "<-Left" ' MyString contains "<-Left ". 
© 2018 Microsoft