'定义一个find函数
Private Function find(s1 As String, s2 As String) As String
Dim i As Integer
For i = 1 To Len(s1)
If i = InStr(1, s1, s2, vbTextCompare) Then
find = Left(s1, i - 1) & Right(s1, Len(s1) - Len(s2) - i + 1)
Exit Function
End If
Next i
find = s1
End Function
'将Text1.Text中的Text2.Text字符删除
Private Sub Command1_Click()
Dim s As String
s = find(Text1.Text, Text2.Text)
Text1.Text = s
End Sub
Text1.Text = Replace(Text1.Text, Text2.Text, "")
将Text1.Text中的Text2.Text字符删除
vb.net
提供了格式化方法
如果数据类型是byte,
short,
integer,
long,
ulong:
a.tostring("d5")
如果数据类型是
integer,
decimal,
single,
double:
a.tostring("00000")
如果数据类型是string
iif(len(a)<
5,
"00000".substring(0,5
-
len(a))
+
a,
a)
不难吧
vb 有 好几个字符串 函数