VB.net 字符串 分割 及 重新倒序组装

    ''' <summary>
    ''' split with ">>>>" , and inverted order
    ''' </summary>
    ''' <param name="groupNamePath"> 123>>>>abc>>>>456 </param>
    ''' <returns> 456 > abc > 123 </returns>
    ''' <remarks></remarks>
    Protected Function transGroupNamePath(ByVal groupNamePath As String) As String
        Dim strResult As String = ""
        Dim strArray As String() = Regex.Split(groupNamePath, ">>>>")

        For i As Integer = strArray.Length - 1 To 0 Step -1
            If Not strArray(i) = "" Then
                If strResult = "" Then
                    strResult = strResult & strArray(i)
                Else
                    strResult = strResult & " > " & strArray(i)
                End If
            End If
        Next
        transGroupNamePath = strResult
    End Function

 

posted on 2013-08-21 14:40  freeliver54  阅读(1723)  评论(0编辑  收藏  举报

导航