解决方案 »

  1.   

    我已经会了Private Sub Command1_Click()
    Dim s1 As String, s2 As String
     Dim a() As String
     ReDim a(1 To 1)
     s1 = "123145"
     Print s1
     a(1) = Mid(s1, 1, 1)
     For i = 2 To Len(s1) Step 1
     For j = 1 To UBound(a)
     If a(j) = Mid(s1, i, 1) Then Exit For
     Next j
     If j > UBound(a) Then
     ReDim Preserve a(1 To UBound(a) + 1)
     a(UBound(a)) = Mid(s1, i, 1)
     End If
     Next i
     For i = 1 To UBound(a)
     s2 = s2 & a(i)
     Next i
     Print s2
    End Sub
      

  2.   

    VB.NET写法:
    Dim s As String = "123145123"
    Dim Result() As String = s.Select(Function(x) x.ToString()).Distinct().ToArray()
      

  3.   

    这个我感觉很简单吧。至少java是。