原题目如下:

Write a function that reverses the order of the words in a string. For instance, your function should transform the string “Do or do not, there is no try.” To “try. No is there not, do or Do”. Assume that all words are space delimited and treat punctuation the same as letters.

以下用VB.net的语法运算:

    Function Convert(ByVal word As String) As String

        Dim words() As String = word.Split(Nothing)

        Dim value As Integer = words.Length

        Dim result As String = ""

 

        Dim helper As String

        For Each helper In words

            result = result + " " & words(value - 1)

            value = value - 1

        Next

        Return result.Trim()

    End Function

posted on 2006-06-09 14:59  nacarat  阅读(405)  评论(0)    收藏  举报