String 函数

根据指定的字符或传送给函数的字符串表达式的第一个字符创建一个字符串。

语法:


String (n As Integer, {expression As Integer | character As String})

返回值:

字符串

参数:

n: Numeric expression that indicates the number of characters to return in the string. The maximum allowed value of n is 2,147,483,648.

Expression」: 用于定义字符 ASCII 码的数字表达式。

Character」: 建立返回字符串要用到的任意单个字符,或者是要用到第一个字符的任意字符串。

错误代码:

5 无效的过程调用

示例:


Sub ExampleString
Dim sText As String
    sText = String(10,"A")
    MsgBox sText
    sText = String(10,65)
    MsgBox sText
End Sub

请支持我们!