Sub t1()
s$ = "abaccdeff"
Do While i <= Len(s)
i = i + 1
t = Mid(s, i, 1)
m = InStr(s, t)
n = InStrRev(s, t)
If m = n Then MsgBox t: Exit Sub
Loop
MsgBox "no"
End Sub
还是用点变量吧,我不这样就会晕{:031:}。
当然m,n一般不会设,只不过这里是为了快速理解。
Sub t4()
s$ = "abcddacde"
Do While i% < Len(s)
i = i + 1
st = Mid(s, i, 1)
Mid(s, i, 1) = " "
If InStr(s, st) < 1 Then Exit Do
s = Replace(s, st, "")
st = ""
Loop
If st <> "" Then MsgBox st
End Sub
t4除了mid外,对此问题毫无意义。