none
循环问题 RRS feed

答案

  • 您好

    參考以下代碼

            Dim name = "abcd"
    
            Dim nameReverse2 As String = String.Empty
            For i As Integer = 0 To name.Length - 1
                nameReverse2 = name(i) + nameReverse2
            Next
            MessageBox.Show(nameReverse2)
    

     


    歡迎參觀我的Blog.NET菜鳥自救會
    • 已标记为答案 ckjason 2011年12月26日 7:49
    2011年12月26日 0:55

全部回复

  • 试试

    Me.Text = StrReverse(Me.Text)


    Be a good forum member. Make this forum a great place to meet and interact with others around the world.
    Helpful Links:

    • Did you go to Library today? Can find what you looking for? Then use Bing | Google
    • Still no go? Try MSDN, find the right Forum and click Ask a question
    • Want a testing ground? Go to Sandbox and have fun!
    • Need to convert the code try Convert C# to VB
    2011年12月25日 16:06
  • 试试

    Me.Text = StrReverse(Me.Text)


    Be a good forum member. Make this forum a great place to meet and interact with others around the world.
    Helpful Links:

    • Did you go to Library today? Can find what you looking for? Then use Bing | Google
    • Still no go? Try MSDN, find the right Forum and click Ask a question
    • Want a testing ground? Go to Sandbox and have fun!
    • Need to convert the code try Convert C# to VB
    我知道这个方法,但我要用循环来得出答案。
    2011年12月25日 16:11
  • 答案要是用循环来显示dcba.

    循环写法


       Dim name As String = "abcd"
    
            For index = name.Length - 1 To 0 Step -1
                Console.Write((name(index)))
    
            Next
    
    


    2011年12月25日 16:33
  •  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim sb As New StringBuilder
            For i As Integer = 0 To Me.Text.Length
                sb = sb.Append(Me.Text.Reverse(i))
            Next
            Me.Text = sb.ToString
    
        End Sub
    

    用reverse?

    Be a good forum member. Make this forum a great place to meet and interact with others around the world.
    Helpful Links:

    • Did you go to Library today? Can find what you looking for? Then use Bing | Google
    • Still no go? Try MSDN, find the right Forum and click Ask a question
    • Want a testing ground? Go to Sandbox and have fun!
    • Need to convert the code try Convert C# to VB
    2011年12月25日 17:11
  • 您好

    參考以下代碼

            Dim name = "abcd"
    
            Dim nameReverse2 As String = String.Empty
            For i As Integer = 0 To name.Length - 1
                nameReverse2 = name(i) + nameReverse2
            Next
            MessageBox.Show(nameReverse2)
    

     


    歡迎參觀我的Blog.NET菜鳥自救會
    • 已标记为答案 ckjason 2011年12月26日 7:49
    2011年12月26日 0:55