10084.html

来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 23 行

HTML
23
字号
<html>
  <head>
    <title>Another solution</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Another solution</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by wei on February 12, 1999 at 04:34:13:<p>
In Reply to: <a href="10082.html">Re: vb□拜</a> posted by □狶 on February 11, 1999 at 23:19:58:<p>
: 叫代&#21018;□□□&#31064;Α絏:<br>: 叫□□From□□&#31450;□Text Box ㎝ㄢ□Label<br>: Dim nArr()<br>: Dim i As Long<br>: Dim j As Long<br>: Dim k As Long<br>: Dim l As Long<br>: Dim sStr As String<br>: Dim sVal1 As String<br>: Dim sVal2 As String<br>: Dim cFlag As Boolean<p>: Private Sub Form_Load()<br>: sStr = "1234567890,.1/;':@#$%^*()_+|[]{}" & """" & "&&"<br>: Label2.Caption = sStr<br>: cFlag = False<br>: i = 1<br>: End Sub<p>: Private Sub Label1_Click()<br>: If Text1.Text <> "" Then<br>:    For i = 1 To Len(Text1.Text)<br>:        sVal1 = Mid(Text1.Text, i, 1)<br>:        For j = 1 To Len(sStr)<br>:            sVal2 = Mid(sStr, j, 1)<br>:            If cFlag = False Then<br>:               If sVal2 = sVal1 Then<br>:                  cFlag = True<br>:               Else<br>:                  cFlag = False<br>:               End If<br>:            End If<br>:        Next j<br>:    If cFlag = False Then<br>:       ReDim Preserve nArr(k)<br>:       nArr(k) = sVal1<br>:       k = k + 1<br>:    Else<br>:       cFlag = False<br>:    End If<br>:    Next i<br>:    sVal1 = ""<br>:    For l = 0 To UBound(nArr)<br>:        sVal1 = sVal1 & nArr(l)<br>:        nArr(l) = ""<br>:    Next l<br>:    Label1.Caption = sVal1<br>: End If<br>: End Sub<p>:  <br>: : 兵&#12531;=&#29853;□﹃皑□s(i)&#12356;□1234567890,.1/;'":@#$%^&*()_+|[]{}ㄤ&#12356;&#12532;□□<br>: : 痹瓃=□s(i)&#12356;□埃□□&#36195;□&#12376;<br>: : □:"string."---->string<br>: :     fat!gh  ---->fatgh<p>: : &#12355;□&#36195;□□粜??<br>: : thanks<p><p>Suppose s[i} is the target string<p>Dim p(34) as string  'Size = number of ilegal char<br>Dim j as integer<br>p[0]="1"<br>p[1]="2"<br>...<br>P[33]=")"<p>for j=0 to 33<br>  s[i]=replace(s[i], p[j], "")<br>next j<br> 
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 10084-->
</ul><!--end: 10084-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?