发布网友 发布时间:2024-10-24 13:30
共3个回答
热心网友 时间:2024-10-31 21:47
vbs中没有直接删除最后几个字符的函数,得这样:
'═════代═══码═══开═══始═════
dim s
s="ABCDEFGHIJKLMN"
s1=StrReverse(s)'得到NMLKJIHGFEDCBA
s2=mid(s1,2)'得到LKJIHGFEDCBA
s=StrReverse(s2)'再一次掉头,得到ABCDEFGHIJKL
msgbox s
'═════代═══码═══结═══束═════
热心网友 时间:2024-10-31 21:52
right
Dim AnyString, MyStr
AnyString = "Hello World" ' Define string.
MyStr = Right(AnyString, 1) ' Returns "d".
MyStr = Right(AnyString, 6) ' Returns " World".
MyStr = Right(AnyString, 20) ' Returns "Hello World".
热心网友 时间:2024-10-31 21:54
dim str
str="123456!!!"
'删除感叹号保留数字
msgbox "方法1: "&left(str,len(str)-3)
msgbox "方法2: "&mid(str,1,len(str)-3)
msgbox "方法3: "&replace(str,"!","")