String Function

依指定的字元或傳送給函式的字串型表示式的第一個字元建立一個字串。

Syntax:


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

Return value:

字串型

Parameters:

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 無效的程序呼叫

Example:


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

Please support us!