StrDup 函数
J# JScript Visual Basic 语言参考StrDup 函数示例 请参见 返回由指定字符重复指定次数后形成的字符串或对象。 Public Shared Function StrDup( _ ByVal Number As Integer, _ ByVal Character As { Char | String } _ ) As String ' -or- Public Shared Function StrDup( _ ByVal Number As Integer, _ ByVal Character As Object _ ) As Object 参数 Number ...
源:Visual Basic 语言参考
返回由指定字符重复指定次数后形成的字符串或对象。
Public Shared Function StrDup( _
ByVal Number As Integer, _
ByVal Character As { Char | String } _
) As String
' -or-
Public Shared Function StrDup( _
ByVal Number As Integer, _
ByVal Character As Object _
) As Object
参数
Number
必选。Integer 表达式。要返回的字符串的长度。
Character
必选。任何有效的 Char、String 或
Object 表达式。将只使用表达式
Private Sub Command1_Click()t = 6'(这里设置从A起的字母个数,A-F时 为6 A-Z时为26)
For i = 1 To t
s = ""
For j = 1 To 2 * i - 1
s = s &Chr(i + 64)
Next
Print Space(t - i) &s &Space(t - i)
Next
For i = 1 To t - 1
s = ""
For j = 1 To (t - i) * 2 - 1
s = s &Chr(64 + t - i)
Next
Print Space(i) &s &Space(i)
Next
End Sub
Dim i, n1, n2, a(100, 100) As IntegerPrivate Sub Form_Load()
i = -1: n = 0
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = i + 1
Select Case i
Case 0 '画菱形
Cls
For n1 = -9 To 9
For n2 = 1 To (9 - Abs(n1) + 1)
Print Tab((n2) * 2 + Abs(n1) + 9)"*"
Next n2
Next n1
Case 1 '画方
Cls
For n1 = 1 To 10
For n2 = 1 To 10
Print Tab(n2 * 2)"*"
Next n2
Next n1
Case 2 '画三角
Cls
For n1 = 1 To 10
For n2 = 1 To (10 - n1)
Print Tab(n2 * 2)"*"
Next n2
Next n1
Case 3 '画三角
Cls
For n1 = 1 To 10
For n2 = n1 To 1 Step -1
Print Tab((10 - n2) * 2 + 2)"*"
Next n2
Next n1
Case 4 '画漏斗
Cls
For n1 = -9 To 9
For n2 = 1 To (Abs(n1) + 1)
Print Tab((n2) * 2 - Abs(n1) + 9)"*"
Next n2
Next n1
Case 5 '画图
Cls
'*************************** 画方
For n1 = 0 To 10
For n2 = 0 To 12
a(n1, n2) = (n2) * 2
Next n2
Next n1
'*************************** 方中掏出菱形
For n1 = 1 To 9
For n2 = 1 To (2 * (5 - Abs(5 - n1)))
a(n1, n2 + Abs(5 - n1) + 1) = 0
Next n2
Next n1
'*************************** 菱形中画方
For n1 = 3 To 7
For n2 = 4 To 9
a(n1, n2) = (n2) * 2
Next n2
Next n1
'*************************** 方中掏出方
For n1 = 4 To 6
For n2 = 5 To 8
a(n1, n2) = 0
Next n2
Next n1
'*************************** 画出图象
For n1 = 0 To 10
For n2 = 0 To 12
If a(n1, n2) <>0 Then
Print Tab(a(n1, n2))"*"
End If
Next n2
Next n1
Case 6 '画曲线
Cls
For n1 = 1 To 3
For n2 = 0 To 6 Step (3.14 / 8)
Print Tab(10 * Sin(n2) + 18)"*"
Next n2
Next n1
Case 7 '画双曲线
Cls
For n1 = 1 To 3
For n2 = 0 To 6 Step (3.14 / 8)
Print Tab(10 * Sin(n2) + 18)"*"
Print Tab(10 * Cos(n2) + 18)"*"
Next n2
Next n1
i = 0
End Select
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)